求助 不知道哪写错了 。。。OJ题

[复制链接]
查看11 | 回复0 | 2021-1-27 07:17:20 | 显示全部楼层 |阅读模式
#include
#include
usingnamespacestd;
classBall
{
protected:
stringopponent;//对手
public:
Ball(stringnam)
{
opponent=nam;
}
virtualvoiddisplay()=0;
};
classBasketball:publicBall{
private:
intscore1,score2;
public:
Basketball(stringnam,intsco1,intsco2):Ball(nam){
score1=sco1;
score2=sco2;
}
voiddisplay()
{
if(score1>score2)
coutscore2)
cout>type;
while(type)
{
cin>>n>>sco1>>sco2;
if(type==1)
{
pb[count++]=newBasketball(n,sco1,sco2);
}
if(type==2)
{
pb[count++]=newFootball(n,sco1,sco2);
}
if(type==3)
{
pb[count++]=newVolleyball(n,sco1,sco2);
}
cin>>type;
}
for(inti=0;idisplay();
}
return0;
}


输入一次就输出而且重复输出多次。。。这是什么情况啊
分 -->
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行