-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcricker_score.cpp
71 lines (64 loc) · 1.29 KB
/
cricker_score.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>
#include<cstdlib>
#include<string.h>
#include<conio.h>
using namespace std;
class cricket_score{
public:
int playernum;
char playername[25];
int over;
char team[10];
int inningsnum;
int innings_total_run=0;
int run;
int wicket;
void innings()
{ for(int i=1;i<=2;i++)
{
cout<<"input player number:";
cin>>playernum;
cout<<"---input player name---\n";
for(int i=0;i<playernum;i++ )
{
cin>>playername;
}
cout<<"over:";
cin>>over;
wicket=playernum;
cin>>team;
for(int i=1;i<over*6;i++)
{
cin>>run;
if(1<=run&& run<=6)
{
innings_total_run+=run;
}
else
{
wicket--;
if(wicket<1)
{
cout<<"all out player";
}
}
}
}
if(innings_total_run>innings_total_run)
{
cout<<"win 1st team";
}
else if(innings_total_run<innings_total_run)
{
cout<<"win 2nd team";
}
else
cout<<"Draw";
}
};
int main()
{
cricket_score innings;
innings.innings();
return 0;
}