/* 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\\CISC1110\\pgms\\chapter8\\myinput.txt"); //comment-out for debugging //ifstream infile("con"); //un-comment for debugging // open output file //ofstream outfile("c:\\bc\\CISC1110\\pgms\\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"); //un-comment when using DevC++ return 0; } void change(string &str) { str += 's'; return; }