forked from Aamangupta70077/Ankul-File
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock_paper_scissor.cpp
More file actions
78 lines (77 loc) · 2.54 KB
/
Copy pathRock_paper_scissor.cpp
File metadata and controls
78 lines (77 loc) · 2.54 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
int input_number;
int temp;
int user = 0, computer = 0, round;
cout<<"\n***Welcome To The Game Rock Paper And Scissors !!!***";
cout<<"\nFirst you have to select the no of round you want to Play:\n";
cin>>round;
for (int i=1; i<=round; i++) {
srand(time(0));
temp = 1 + (rand() % 3);
cout<<"\nRound:"<<i;
cout<<"\nAlright you have to select your choice...";
cout<<"\n1 Denotes for the rock:";
cout<<"\n2 Denotes for the paper:";
cout<<"\n3 Denotes for the scissor:";
cin>>input_number;
switch (input_number) {
case 1:
cout<<"\nYou Selected 1 for the Rock.";
cout<<"\nComputer Gets: "<<temp;
if (temp == 1)
cout<<"\nMatch tie..";
else if (temp == 2) {
cout<<"\nPaper beats rock > system win";
computer++;
}
else if (temp == 3) {
cout<<"\nRock beats scissor > you win";
user++;
}
continue;
case 2:
cout<<"\nYou Selected 2 for the Paper.";
cout<<"\nComputer Gets: "<<temp;
if (temp == 1) {
cout<<"\nPaper beats rock > you win";
user++;
}
else if (temp == 2)
cout<<"\nMatch Tie...";
else if (temp == 3) {
cout<<"\nscissor beats Paper > system win";
computer++;
}
continue;
case 3:
cout<<"\nYou Selected 3 for the scissor.";
cout<<"\nComputer Gets: "<<temp;
if (temp == 1) {
cout<<"\nRock beats scissor > system win";
computer++;
}
else if (temp == 2) {
cout<<"\nscissor beats Paper > you win";
user++;
}
else if (temp == 3)
cout<<"\nMatch tie...";
continue;
default:
cout<<"\nWrong choice entered by the user";
break;
}
}
if (user > computer)
cout<<"\nYou win the final game";
else if (computer > user)
cout<<"\nComputer win the final game";
else
cout<<"\nFinal Match Tied...";
}