Skip to content

Commit b630e20

Browse files
authored
Add necessary comments
1 parent 37a7406 commit b630e20

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Arrays/Fair Playoff.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ int main()
2424

2525
while(T--)
2626
{
27-
int s[4], i, f1 = 0, f2 = 0,sm = 0, no = 0, yes = 0;
27+
int s[4], i, f1 = 0, f2 = 0, sm = 0, no = 0, yes = 0;
2828
for(i = 0; i < 4; i++)
29-
cin>>s[i];
29+
cin>>s[i]; //a 1-D array to store the skills of 4 players
3030

31-
if(s[0] > s[1])
31+
if(s[0] > s[1]) //comparing first player with second
3232
f1 = s[0];
3333

3434
else
3535
f1 = s[1];
3636

37-
if(s[2] > s[3])
37+
if(s[2] > s[3]) //comparing third player with fourth
3838
f2 = s[2];
3939

4040
else
@@ -49,15 +49,15 @@ int main()
4949

5050
for(i = 0; i < 4; i++)
5151
{
52-
if(s[i] > sm)
53-
yes++;
52+
if(s[i] > sm) //to check if the finals were fair or not
53+
yes++; //assign 'yes' if the players with highest skills are in finals
5454
else
55-
no++;
55+
no++; //assign 'no' if the players with highest skills were not in finals
5656
}
5757
if(yes == 1)
58-
cout<<"YES"<<endl;
58+
cout<<"YES"<<endl; //print 'YES' for a fair playoff
5959
else
60-
cout<<"NO"<<endl;
60+
cout<<"NO"<<endl; //print 'NO' for an unfair playoff
6161
}
6262
return 0;
63-
}
63+
}

0 commit comments

Comments
 (0)