The goal for this question: DISCLAIMER****** CODE MUST BE WRITTEN IN C CODE. NOT C++, C#, etc. To create a program that MUST utilize the functions (argc, argv, char strstr, and possibly even Getline) to, 1. Open a file 2. Read the file 3. Read txt file line by line 4. count up the number of times a specified word is read(HOWEVER! IT CANNOT COUNT MORE THAN ONE WORD PER LINE!) ex. if the code comes across a line in a text file that has the word cookie in it 3 times. It can only count the word ONCE since it is counting line by line. Not all the words added up. 5. then display to the user the total number of lines with the specific word. ex. gcc -o ./ <"word to be searched">
The goal for this question:
DISCLAIMER****** CODE MUST BE WRITTEN IN C CODE. NOT C++, C#, etc.
To create a program that MUST utilize the functions (argc, argv, char strstr, and possibly even Getline) to,
1. Open a file
2. Read the file
3. Read txt file line by line
4. count up the number of times a specified word is read(HOWEVER! IT CANNOT COUNT MORE THAN ONE WORD PER LINE!) ex. if the code comes across
a line in a text file that has the word cookie in it 3 times. It can only count the word ONCE since it is counting line by line. Not all the words added up.
5. then display to the user the total number of lines with the specific word.
ex.
gcc -o <program name>
./<program name> <file name.txt> <"word to be searched">
then execute a total number of times words came up. Again, only count up by one even if there is that specified word multiple times in one line.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps