-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstopapsci.cpp
More file actions
39 lines (39 loc) · 766 Bytes
/
stopapsci.cpp
File metadata and controls
39 lines (39 loc) · 766 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
36
37
38
39
#include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std;
main()
{ int dur,n,i,c,s=0,x;
cout<<"How many rounds?\n";
cin>>dur;
for(i=1;i<=dur;i++){
cout<<"\nEnter your choice - 1 : stone / 2 : paper / 3 : scissor \n";
cin>>c;
if (c==1)
cout<<"You chose stone \n";
else if (c==2)
cout<<"You chose paper \n";
else
cout<<"You chose scissor \n";
srand(time(0));
n=rand()%3+1;
if (n==1)
cout<<"System chose stone \n";
else if (n==2)
cout<<"System chose paper \n";
else if (n==3)
cout<<"System chose scissor \n";
else
cout<<"Bonus !";
if(c==1&&n==3||c==2&&n==1||c==3&&n==2)
s++;
else if (n==c)
cout<<"Draw\n";
else
cout<<"Oops\n";
}
cout<<"--------------\n";
cout<<"Your score : "<<s<<"/"<<dur;
cin>>x;
return 0;
}