// Ch. 11 Demo Program #3
// Mr. Minich
// Purpose - writing user inputs to a file until the user enters
// a sentinel value
#include <iostream.h>
#include <fstream.h>
#include "apstring.h"
int main()
{
apstring name;
int score = 0;
ofstream hiScores;
hiScores.open("hiscores.txt"); // opens the file for output
// Or.... ofstream hiScores("hiscores.txt");
while (1)
{
cout << "Enter your name (type \"xxx\" to quit): ";
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