#include #include #include using namespace std; string get_file_name(string desc); int main () { ifstream infile; ofstream outfile; string in_name, out_name; char ch; // get the name of the input file and open it. in_name = get_file_name("Input File"); infile.open(in_name.c_str()); if (!infile) { cout << "Cound not open " << in_name << endl; } else { // get the name of the output file and open it. out_name = get_file_name ("Output File"); outfile.open(out_name.c_str()); // tell the user that we are starting the loop. cout << "COPYING from " << in_name << " to " << out_name << endl; infile.get(ch); while (infile) { outfile << ch; cout << ch; infile.get(ch); } outfile.close(); infile.close(); } } string get_file_name(string desc){ string resp; cout << "Enter the name of the " << desc << endl; cin >> resp; cout << "Opening " << resp << " as the " << desc << endl; return(resp); }