-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassignment3Q1.cpp
73 lines (60 loc) · 1.21 KB
/
assignment3Q1.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
using namespace std;
//Q1
int main()
{
string p_wins = "Paper covers stone :)";
string r_wins = "Scissors cuts paper :)";
string s_wins = "Rock breaks scissors :)";
string in1;
string in2;
cout<< "This is a two-player rock-paper-scissors game" << endl;
cout<< "Enter either P-paper,R-rock or S-scissor"<<endl;
cin>> in1;
cin>> in2;
if(in1 == "P")
{
if (in2 == "R")
{
cout<< "IN1 wins the game\n";
cout<<"Because: "<<p_wins<<endl;
}
else if (in2 == "P")
{
cout<<"Sorry !! game ties here :D"<<endl;
}
else
{
cout<< "IN2 wins the game\n";
cout<<"Because: "<<s_wins<<endl;
}
}
else if(in1 == "R")
{
if (in2 == "S")
{
cout<< "IN1 wins the game\n";
cout<<"Because: "<<r_wins<<endl;
}
else if (in2 == "R")
{
cout<<"Sorry !! game ties here :D"<<endl;
}
else
{
cout<< "IN2 wins the game\n";
cout<<"Because: "<<p_wins<<endl;
}
}
string gameReset;
cout<< "To reset the game type Y if no then N : ";
cin>> gameReset;
if(gameReset == "Y")
{
cout<< main();
}
else
{
cout<< "Have a nice day :) !";
}
}