// This program writes data to a file. #include #include using namespace std; int main() { int x1 ; ofstream outputFile("demofile.txt", ofstream::app) ; //outputFile.("demofile.txt", ofstream::app) ; cout << "Now writing data to the file.\n"; // Write four names to the file. outputFile << "Bach\n"; outputFile << "Beethoven\n"; outputFile << "Mozart\n"; outputFile << "Schubert\n"; x1 = 100 ; outputFile << x1 << endl ; // Close the file outputFile.close(); cout << "Done.\n"; return 0; }