Find the frequency of any given word in a book. Please solve the problem using c++
Book.txt
This C++ program will read a word from user and then count its total occurrence in a text file “book.txt”. Make sure you have already create this text file and have some text in it. Place this file in the same directory where your program source file is present.
=================================================
C++ Code:
// Find the frequency of any given word
#include <iostream>
#include <cstdlib>
#include<fstream>
#include<string.h>
int main()
{
std::ifstream fin;
fin.open("book.txt");
//opening text file
int count=0;
char ch[20],c[20];
/* Input word from the user */
std::cout<<"Enter a word to count the frequency:";
std::cin >> c;
while(fin)
{
fin>>ch;
if(strcmp(ch,c)==0)
count++;
}
std::cout<<"Frequency of a word "<<c<<" is = "<<count;
fin.close(); //closing file
}
=========================================
Output:
Enter a word to count the frequency: file
Frequency of a word file is = 4
Output Snapshots:

Please give Thumbs up...
Find the frequency of any given word in a book. Please solve the problem using c++
C Programming Language on Linux - Word Frequency Program Please write a Program in C that will accept a text file name as a command-line argument via a main program that will do the following: First, read the file (first pass) and create a linked list of words (in their order of occurrence), with the frequency of each word set to 0. Then, read the file (second pass) and for each word identified, search the linked list, and when found,...
Please help me solve the problem, I will
rate! Thank you!!
Problem 4. Given any 5 points in a unit square, show that two of these points must be within t, of each other.
please help me using C++ to solve the problem below Use the bisection algorithm to find an approximate solution z to the equation x^(5.3) + (3.5)^x = N where N is your 7-digit phone number, and: (a) z is correct to 2 significant figures. (b) z is correct to 2 decimal places.
Please help. I’m the not the best with word problems
3. Solve the word problem. A gallon of gold weighs 160.7 pounds, while a gallon of silver weighs 87.6 pounds. How many pounds would 6.2 containers weigh if each container held a gallon of gold and a gallon of silver? O1,743.22 pounds O 14,620.44 pounds 1, 539.46 pounds 1,573.66 pounds 6.Solve the word problem. p at the track-and-field event. His first jumo was 18.3 feet. His second jump was 2.9...
what is the source book of this question
or could any one please solve it
Question 1 Design the flexible pavement layer thicknesses using the data given below. Design period: 20 years Pi- 4.2; Pt 2 Reliability (R)-90 % Standart deviation (So) 0.40 Vehicle Type AADT Axle load (ton) Growth rate (%) Car Truck Bus 10000 1500 800 1.8 13 10 4 1.5 a 1-0.44 (asphalt concrete) a2-0.14 (granular base, CBR 100) a3- 0.10 (granular subbase, CBR- 40) Subgrade CBR...
Write a program in C to find the number of occurrences a given word appears in the given string: int LeterInAString(char c, char *s); Check whether the string is NULL. Also, the char could be any char including special symbols.
Please help solve this problem using the given equation and
kindly write down all steps clearly.
please solve this problem it CAUCHY-EUIER PROBLEM.
please try to solve it by using variation of parameter not
UC-method.
Example. Solve the folloinP J.VP. (CE DE)
Example. Solve the folloinP J.VP. (CE DE)
One of the best ways to learn how to solve a word problem in algebra is to design word problems of your own. Creating a word problem makes you very aware of precisely how much information is needed to solve the problem. You must also focus on the best way to present information to a reader and on how much information to give. As you write your problem, you gain skills that will help you solve problems created by others....
C++ Program Word frequency analysis. [32] Write a program which can accept via stdin any number of words until the user types quit. Load the words into an array (use realloc to control the size). Then output the words in alphabetic order and give the number of times the word was used. Call this frequency.cpp.