forked from rjkalash/hacktoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStone_Paper_Scissor_Game.cpp
52 lines (42 loc) · 967 Bytes
/
Stone_Paper_Scissor_Game.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
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
int quit;
cout<< "\n\n\t\t\t\t**********WELCOME TO STONE PAPER SCISSOR GAME****************\n\n\n";
while(quit != -1)
{
srand(time(0));
int userNum;
int randomNum;
cout<<"1.Rock"<<endl;
cout<<"2.Paper"<<endl;
cout<<"3.Scissors"<<endl;
cout<<endl;
cin>>userNum;
cout<<endl;
randomNum = (rand()%3)+1;
if(userNum == -1)
{
return 0;
}
if(userNum == randomNum)
{
cout<<"Tie!"<<endl;
}
if((randomNum == 1 && userNum == 2)||
(randomNum == 3 && userNum ==1) ||
(randomNum == 2 && userNum == 3))
{
cout<<"You Win!"<<endl;
}
else
{
cout<<"You Lose!"<<endl;
}
}
return 0;
}