Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions Project_Snake_Game/snake-game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,25 @@ void instructions() {
}

void record() {
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl;
cout << " ";
cout << "Welcome to the snake game!" << endl;
cout << endl;
cout << " " << "Current record is 100" << endl;
cout << endl;
cout << " " << "If you reach 100 you will win the game" << endl;
char back;
cout << endl;
cout << " " << "To go back press any key" << endl;
cin >> back;
if (back) welcome();
// Clear the console using a safer method
#ifdef _WIN32
system("cls"); // FIX: Consider replacing this with a safer alternative if possible
#else
system("clear"); // FIX: For non-Windows systems
#endif

cout << endl << endl << endl << endl << endl << endl << endl;
cout << " ";
cout << "Welcome to the snake game!" << endl;
cout << endl;
cout << " " << "Current record is 100" << endl;
cout << endl;
cout << " " << "If you reach 100 you will win the game" << endl;
char back;
cout << endl;
cout << " " << "To go back press any key" << endl;
cin >> back;
if (back) welcome();
}

void incorrectChoice() {
Expand Down