/ This program prompts the user for input and output file names. The input file // contains 4 lines of 2 integers on each line. For each set of integers, the sum and // product is calculated and the result output, in equation form, to the output file. #include #include using namespace std; int main() { char filename[40]; int x, y; int count = 0; ifstream fin; ofstream fout; cout << "Input file name: " ; cin >> filename; fin.open(filename); if (!fin) { cout << endl << "Could not open input file" << endl; return 1; } cout << endl << "Output file name: " ; cin >> filename; fout.open(filename); if (!fout) { cout << endl << "Could not open output file" << endl; return 1; } while (count < 4) { fin >> x >> y; fout << x << " + " << y << " = " << x + y; fout << x << " * " << y << " = " << x * y << endl; count ++; } fin.close(); fout.close(); return 0; }