Write a C++ program that allows the user to search a file “MyText.txt” located in the current workspace for any word (String). The program should print the result of the search. In the event the word is found the program should indicate the line where it was found in the text file. Solution Here is the code you have been asking for, #include <cstdlib> #include <iostream> #include <fstream> #include <string.h> using namespace std; int main() { int countwords=0; string path, line, word; cout<<\"Write the path of the file.\"<<endl; cin>>path; ifstream File(path.c_str()); if(File.is_open()) { cout<<\"File found.\"<<endl; line=File.get(); cout<<\"Write the word you\'re searching for.\"<<endl; cin>>word; while(!File.eof()) { if(word.compare(line)==0) countwords++; } cout<<\"The word has been found \"<<countwords<<\" times.\"<<endl; File.close(); } else { cout<<\"Error! File not found!\"; exit(1); } } .