-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
72 lines (64 loc) · 2.15 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <iostream>
#include <string>
#include <conio.h>
#include "includes/Users.h"
#include "includes/Game.h"
#include "includes/Sudoku.h"
#include "includes/custom_error.h"
using namespace std;
int main() {
bool q = true;
int choice;
Sudoku game;
while (q)
{
system("cls");
cout << "\n-------------SUDOKU BOARD GAME-------------" << endl;
cout << "___________________________________________" << endl;
cout << "| 1. \t\tStart Game |" << endl;
cout << "|_________________________________________|" << endl;
cout << "| 2. \t\tLeaderboard |" << endl;
cout << "|_________________________________________|" << endl;
cout << "| 3. \t\tHow to Play |" << endl;
cout << "|_________________________________________|" << endl;
cout << "| 4. \t\tAbout Us |" << endl;
cout << "|_________________________________________|" << endl;
cout << "| 5. \t\tQuit |" << endl;
cout << "|_________________________________________|" << endl;
cout << "\n >> ";
cin >> choice;
try{
if (cin.fail()){
throw CustomError("Error: expected a number got alphabet. Exiting ...");
}else{
switch (choice)
{
case 1:
game.startGame();
break;
case 2:
game.leaderboard();
break;
case 3:
game.howToPlay();
break;
case 4:
game.about();
break;
case 5:
q = false;
cout << "\nexiting . . ." << endl;
break;
default:
cout << "\nNot a valid choice !!!" << endl;
break;
}
}
}
catch(const CustomError& error) {
cout << error.getMessage() << std::endl;
break;
};
}
return 0;
};