// Mr. Minich
// CMPSC 201
// Ch. 8 Demo Program #6
// January 20, 2000
// Purpose - to illustrate how to append to a file
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string name;
int score = 0;
ofstream hiScores;
hiScores.open("HiScores.txt", ios::app); // opening the file for appending
while (1)
{
cout << "Enter your name (type \"xxx\" to quit): ";
// backslash is the escape operator and used to display a quotation mark.
cin >> name;
if (name == "xxx")
{
break;
}
cout << "Enter your score: ";
cin >> score;
hiScores << name;
hiScores << endl;
hiScores << score;
hiScores << endl;
}
return 0;
}// end of main