-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
42 lines (35 loc) · 1.13 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*This code is made available under the Creative Commons Zero 1.0 License
(https://creativecommons.org/publicdomain/zero/1.0)*/
/*
Guess The Number Game
Created By: sdam1n
*/
#include "utils.h"
//main function
int main ()
{
srand(time(NULL));
int choice; // menu choice
file_default_value(); // setting the file default value before the game starts
do
{
// game menu
cout << "GAME MENU" << endl;
cout << "Enter 1 to Play The Game" << endl << "Enter 2 to Quit The Game" << endl;
cin >> choice; // for choosing to play game or quit
switch(choice) // determines action after choice
{
case 1: // playing the game
play_game();
break;
case 2: // quiting the game
cout << "Quiting the game..." << endl;
print_highest_score(); // func call for printing highest score after quiting the game
break;
default: // to choose only 1 & 2
cout << "Choose between 1 & 2" << endl;
break;
}
}while(choice !=2);
return 0;
}