/* Program to illustrate passing a string to a function */ #include #include #include using namespace std; //function prototypes void change(string &str); int main() { string line; // open input file ifstream infile("c:\\bc\\cis1_5\\newpgms\\chapter8\\myinput.txt"); //comment-out for debugging // ifstream infile("con"); //un-comment for debugging // open output file // ofstream outfile("c:\\bc\\cis1_5\\newpgms\\chapter8\\myoutput.txt"); //comment-out for debugging ofstream outfile("con"); //un-comment for debugging while (getline(infile, line)) { change(line); outfile << line << endl; } infile.close(); //close input file outfile.close(); //close output file system("pause"); return 0; } void change(string &str) { str += 's'; return; }