diff --git a/Testings/SaveLoad/SaveLoad.cpp b/Testings/SaveLoad/SaveLoad.cpp index 7821a7f5b08095993ad6f42c27027950eb9519e8..5062f75f88b6289c264e96e214c71bfabdfd5268 100644 --- a/Testings/SaveLoad/SaveLoad.cpp +++ b/Testings/SaveLoad/SaveLoad.cpp @@ -14,11 +14,11 @@ void SaveLoad::pushBackNewScoreAndSort(Scores Score){ } void SaveLoad::displayScores(){ - cout << "Rank Name Score" << endl; - int i = 1; + cout << "Rank" << "\t\t" << "Name" << "\t\t" << "Score" << endl; - for (auto score : scores){ - cout << i++ << "\t" << score.getName() << "\t" << score.getScore() << endl; + for (int i = 0; i < 10; i ++){ + + cout << i+1 << "\t\t" << scores.at(i).getName() << "\t\t" << scores.at(i).getScore() << endl; } } @@ -30,7 +30,7 @@ void SaveLoad::userInputNameMakeScore(int intScore){ try{ cin >> userNameInput; if(strlen(userNameInput) != 3){ - throw runtime_error("Invalid User Name input ! \n"); + throw runtime_error("Invalid User Name input! \n"); } break; diff --git a/Testings/SaveLoad/main.cpp b/Testings/SaveLoad/main.cpp index 5ed416789a89a56b34b0fd3fc88297220eb5a141..e66eec62b57228cfb54dd0210a7926e579143166 100644 --- a/Testings/SaveLoad/main.cpp +++ b/Testings/SaveLoad/main.cpp @@ -13,23 +13,7 @@ int main(){ // char userName[3]; SLSnake second; second.LoadContainers(); - - // cout << "Enter a username with a length of 3 characters\n"; - // cin >> userName; - // //here is a temporary score input system - // //in the final project the score will be taken automatically from the system. - // int score; - // cout << "Enter a score: "; - // cin >> score; - // cout << endl; - - // Scores score1(userName, score); - // second.pushBackNewScoreAndSort(score1); - // second.updateFile(); - - // second.displayScores(); - - second.userInputNameMakeScore(9999); + second.userInputNameMakeScore(10000); second.updateFile(); second.displayScores(); diff --git a/Testings/SaveLoad/snakedata.txt b/Testings/SaveLoad/snakedata.txt index 6c1255245d0c86ef7bfc7f10c8e393380a815f46..fe6698743ddda1b8c4a2ecce90633a4583ef893b 100644 --- a/Testings/SaveLoad/snakedata.txt +++ b/Testings/SaveLoad/snakedata.txt @@ -2,10 +2,13 @@ NAME SCORE nge 654346 vfd 45365 cdn 21474 -bbb 9999 +ooo 10000 +LOP 10000 vfr 9999 ddd 9999 Kyl 9999 +PPP 9999 +bbb 9999 vfd 4636 vev 4536 DVS 3423