【发布时间】:2011-05-01 19:41:32
【问题描述】:
int sc1,sc2,a=0,b=0;
do
{
printf("Give the scores\n");
scanf("%d %d", &sc1,&sc2);
//===============================================
if (sc1 > sc2)
a+=1;
else if (sc1<sc2)
b+=1;
else if (sc1==sc2)
printf("tie\n");
//===============================================
if (a>b)
printf("team 1 is in the lead\n");
else if (a<b)
printf("team 2 is in the lead\n");
else if (b==a)
printf("tie\n");
}
while((a==3) || (b==3));
//===============================================
if (a==3)
printf("team 1 got the cup");
else
printf("team 2 got the cup");
我觉得我写错了。我已经搜索了很多,但似乎找不到它有什么问题。
(两支球队中的一支可以赢得杯赛,该球队必须获得3胜)
*否则如果(sc1
*else if(a>b)
【问题讨论】:
-
如果您准确描述出了什么问题会有所帮助。
-
为什么不用 cin 和 cout 而不是 scanf 和 printf?
标签: c++ loops while-loop do-while