-
Notifications
You must be signed in to change notification settings - Fork 0
/
rock_paper.cpp
61 lines (61 loc) · 1.51 KB
/
rock_paper.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
#include <iostream>
using namespace std;
int main()
{
int m1 = 0, m2 = 0;
string p1 = "rock", p2 = "paper", p3 = "scissors", p4, p5, n1, n2;
cout << "Please, enter the first name\n";
cin >> n1;
cout << "Please, enter the secound name\n";
cin >> n2;
while (1)
{
cout << "Please, enter the first state(rock,paper,scissors)\n";
cin >> p4;
cout << "Please, enter the secound state(rock,paper,scissors)\n";
cin >> p5;
if (p4 != p1 && p4 != p2 && p4 != p3)
{
break;
}
else if (p5 != p1 && p5 != p2 && p5 != p3)
{
break;
}
else if (p4 == p2 && p5 == p1)
{
m1++;
cout << n1 << " is winer!!!!\n" << n1 << " " << m1 << " " << n2 << " " << m2 << endl;
}
else if (p4 == p1 && p5 == p3)
{
m1++;
cout << n1 << " is winer!!!!\n" << n1 << " " << m1 << " " << n2 << " " << m2 << endl;
}
else if (p4 == p3 && p5 == p1)
{
m1++;
cout << n1 << " is winer!!!!\n" << n1 << " " << m1 << " " << n2 << " " << m2 << endl;
}
else if (p4 == p5)
{
cout << "no one is loser ,,,,no one is winer\n" << n1 << " " << m1 << " " << n2 << " " << m2 << endl;
}
else if (p5 == p2 && p4 == p1)
{
m2++;
cout << n2 << " is winer!!!!\n" << n1 << " " << m1 << " " << n2 << " " << m2 << endl;
}
else if (p5 == p1 && p4 == p3)
{
m2++;
cout << n2 << " is winer!!!!\n" << n1 << " " << m1 << " " << n2 << " " << m2 << endl;
}
else if (p5 == p3 && p4 == p1)
{
m2++;
cout << n2 << " is winer!!!!\n" << n1 << " " << m1 << " " << n2 << " " << m2 << endl;
}
}
return 0;
}