-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPrincipal.cpp
65 lines (52 loc) · 1.2 KB
/
Principal.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
#include <conio.h>
#include <stdio.h>
#include "Menu.h"
#include "Joc.h"
#include "GestioResultats.h"
#define JUGAR '1'
#define CONFIGURAR '2'
#define PUNTUACIO '3'
#define SORTIR '4'
void main()
{
TipusJugador TMillorsJugadors[MAX_MILLORSJUGADORS];
char opcio;
char nivell = '1';
int punts = 0;
int posicio = -1;
InicialitzarTaulaMillorJugadors(TMillorsJugadors);
do {
MenuPrincipal();
opcio = _getch();
switch (opcio)
{
case JUGAR:
punts = Joc(nivell-'0');
posicio = EsMillorPuntuacio(TMillorsJugadors, punts);
if (posicio >= 0)
{
DesplacarArray(TMillorsJugadors, posicio);
system("cls");
EmplenarPosicioTaula(TMillorsJugadors[posicio], punts);
}
break;
case CONFIGURAR:
do {
MenuNivellDificultat();
nivell = _getch();
if ((nivell != '1') && (nivell != '2') && (nivell != '3'))
{
printf("Incorrect option.\n");
Sleep(200);
}
} while ((nivell != '1') && (nivell != '2') && (nivell != '3'));
break;
case PUNTUACIO:
system("cls");
EscriuRanking(TMillorsJugadors);
printf("Press any key to go back");
_getch();
break;
}
} while (opcio != SORTIR);
}