-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC++ game
65 lines (49 loc) · 1.38 KB
/
C++ game
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 <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <dos.h>
#include <time.h>
int main ()
{
char k, val1;
int l, val2, ch1;
for (int m=0; m<=9; m++)
{
cout<<">>>>";
delay (100);
}
cout<<endl;
gotoxy(20,8); cout<<" _______________________________"<<endl;
gotoxy(20,9); cout<<"| Press 1 to enter the game |"<<endl;
gotoxy(20,10); cout<<"| Press 0 to exit the game |"<<endl;
gotoxy(20,11); cout<<"| {LISTIKA ESTIMATOR} |"<<endl;
gotoxy(20,12); cout<<"|_______________________________|"<<endl;
cout<<"Enter your choice {1/0}:";
cin>>ch1;
cout<<endl;
if (ch1==1)
{
gotoxy(20,21); cout<<"***************************************"<<endl;
gotoxy(20,22); cout<<"** WELCOME TO LISTIKA ESTIMATOR **"<<endl;
gotoxy(20,23); cout<<"***************************************"<<endl;
srand(time(0));
int number;
number = rand() % 1000 + 1;
int guess;
do {
cout << "Enter your estimate: ";
cin >> guess;
if (guess < number)
cout << "Your estimate is less, than the secret number" << endl;
else if (guess > number)
cout << "Your estimate is more, than the secret number" << endl;
else
cout << "Your guess is right!" << endl;
} while (guess != number);
system("PAUSE");
return 0;
}
else
return 0;
}