-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimon_says.cpp
More file actions
35 lines (32 loc) · 756 Bytes
/
Copy pathsimon_says.cpp
File metadata and controls
35 lines (32 loc) · 756 Bytes
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
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
#define SIZE 10
#define MAX_LEVEL 10
int main() {
vector<uint8_t> numbers(SIZE, 0);
srand(time(NULL));
cout << "Hi! Press Enter to start";
getchar();
cout << "Let's play!" << endl;
uint8_t level = 0;
while(level <= MAX_LEVEL) {
numbers[level++] = rand() % 101;
system("clear");
cout << (int) numbers[level-1] << endl;
int guess;
for(uint8_t idx = 0; idx < level; idx++) {
cout << "Guess[" << (int) idx << "]: ";
cin >> guess;
if(guess != numbers[idx]) {
cout << "Wrong!!!" << endl;
cout << guess << " " << (int) numbers[idx] << endl;
return 0;
}
}
cout << "Good job!" << endl;
}
cout << "WOW! YOU WON!!!" << endl;
return 0;
}