-
Notifications
You must be signed in to change notification settings - Fork 0
/
petit_jeu.cpp
49 lines (33 loc) · 879 Bytes
/
petit_jeu.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
/**********************************************
Description:
by: BUNELIER Hugo | github bubudotsh
Created: 2022-10-04 17:41:10
Updated: 2022-10-04 18:30:32
************************************************/
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int coup, x, y = 0;
srand(time(NULL));
int nb = rand() % 100 + 1;
cout << "nombre de coup max: " << endl;
cin >> coup;
while (true) {
if (y == coup)
return EXIT_SUCCESS;
cout << "\nentrer un nombre: " << endl;
cin >> x;
if (x == nb) {
cout << "trouver" << endl;
break;
} else if (x < nb) {
cout << "plus grand" << endl;
} else {
cout << "plus petit" << endl;
}
y++;
}
cin.get(); cin.ignore();
return EXIT_SUCCESS;
}