#include #include // Library for I/O commands #include using namespace std; int change_file(ifstream&, ofstream&, char, char); //This is Lab #4. //The objections of this lab is to learn how to write an program that reads from a file. // int main() { int return_counter; char pick, mypick; ifstream fin; ofstream fout; fin.open("lab4.txt"); //A call to open the file labeled "lab4.txt" which is the input file. if (fin.fail ()) //This is the error checking code to display on the screen if the file has opened or not. { cout << "In stream file has FAILED to open." << endl; //Statement if file failed to open. exit (1); } else cout << "File : lab4.txt has been opened successfully!" << endl; //Statement if the file opened successfully. fout.open("myFile.txt"); if (fout.fail ( ))//Error code to check if file opened or not. { cout << "Out stream has FAILED to open!" << endl;//Statement if file failed to open. exit (1); } cout << "File : myfile.txt. has been opened successfully!" << endl; cout << "Which character do you want to change?" << endl; //Asking the user what to change. cin >> pick;//Character that user wants to change. cout << "What character do you want to change it as?" << endl; //Asking the user what to change it as. cin >> mypick;//Character user what to change it as. return_counter = change_file(fin, fout, pick, mypick); //CAll to reference the definition. From Part 2. cout << pick <<" Was changed to " << mypick <<" " << return_counter << "times" <