Question: Im getting a file error for my output. Create a program named FileSearch.cpp, that prompts the user for a file name and a term to
Im getting a file error for my output.
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 spaces.
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". C: \cpp\FileSearch>g++ -Wextra -std=c++17 -o FileSearch FileSearch.cpp c: \cpp\FileSearch>FileSearch Enter the name of the file: input.txt Could not open "input. txt" C: \cpp\Filesearch>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
