Question: It won't compile correctly or my code is wrong in C + + / g + + . Create a program named FileSearch.cpp , that

It won't compile correctly or my code is wrong in C++/g++.
Create a program named FileSearch.cpp, that prompts the user for a file name and a term to search for. The
program then displays a message indicating the number of times the search term appears in the file. The search term
can be a word, number, or anything that doesn't contain whitespace characters.
The following examples are what should be displayed if there is a file named input.txt, with the following content.
But I will sing of your strength and will joyfully proclaim your faithful love in the
morning. For you have been a stronghold for me, a refuge in my day of trouble.
Psalm 59:16 CSB
Sample Output (user input is in yellow)
Enter the name of the file: input.txt
Enter a value to search for: stronghold
The word "stronghold" appears 1 time(s) in "input.txt".
Sample Output (user input is in yellow)
Enter the name of the file: input.txt
Enter a value to search for: STRONGHOLD
The word "STRONGHOLD" appears 0 time(s) in "input.txt".
Sample Output (user input is in yellow)
Enter the name of the file: input.txt
Enter a value to search for: of
The word "of" appears 2 time(s) in "input.txt".
Sample Output (user input is in yellow)
Enter the name of the file; input
Could not open "input",
Submit only your source file named FileSearch.cpp.
Create a program named FileSearch.cpp, that prompts the user for a file name and a term to search for. The
program then displays a message indicating the number of times the search term appears in the file. The search term
can be a word, number, or anything that doesn't contain whitespace characters.
The following examples are what should be displayed if there is a file named input.txt, with the following content.
But I will sing of your strength and will joyfully proclaim your faithful love in the
morning. For you have been a stronghold for me, a refuge in my day of trouble.
Psalm 59:16 CSB
Sample Output (user input is in yellow)
Enter the name of the file: input.txt
Enter a value to search for: stronghold
The word "stronghold" appears 1 time(s) in "input.txt".
Sample Output (user input is in yellow)
Enter the name of the file: input.txt
Enter a value to search for: STRONGHOLD
The word "STRONGHOLD" appears 0 time(s) in "input.txt".
Sample Output (user input is in yellow)
Enter the name of the file: input,txt
Enter a value to search for: of
The word "of" appears 2 time(s) in "input,txt",
Sample Output (user input is in yellow)
Enter the name of the file; input
Could not open "input",
Submit only your source file named FileSearch, cpp.
It won't compile correctly or my code is wrong in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!