After I type in the my name, the program just closes. I have tried a system("pause") and tried asking for input and it still close for some reason.Code:char name[50]; char exit; cout << "Please enter you name for the High Scores list : "; cin.getline(name, 50); ofstream WriteFileScore("HiScores.txt"); if(!WriteFileScore.is_open()) { //The file did not open cout << "Error Opening HiScores.txt."; exit = getch(); } else { WriteFileScore << player.score; WriteFileScore.close(); } ofstream WriteFileName("HiScoreNames.txt"); if(!WriteFileName.is_open()) { //The file did not open cout << "Error Opening HiScoreNames.txt."; exit = getch(); } else { WriteFileName << name; WriteFileName.close(); }
Thanks for any help.



LinkBack URL
About LinkBacks


