File Names as Input
//Reads three numbers from the file specified by the user,
//sums the numbers, and writes the sum to another file
char in_file_name[16], out_file_name[16];
cout << "I will sum three numbers taken from an input\n"
<< "file and write the sum to an output file.\n";
cout << "Enter the input file name (maximum of 15 characters):\n";
cout << "Enter the output file name (maximum of 15 characters):\n";
cout << "I will read numbers from the file "
<< in_file_name << " and\n"
<< "place the sum in the file "
<< out_file_name << endl;
in_stream.open(in_file_name);
cout << "Input file opening failed.\n";
out_stream.open(out_file_name);
cout << "Output file opening failed.\n";
int first, second, third;
in_stream >> first >> second >> third;
out_stream << "The sum of the first 3\n"
<< "numbers in " << in_file_name << endl
<< "is " << (first + second + third)
cout << "End of Program.\n";