yixinxiangchen 2017-06-12 11:23 采纳率: 14.3%
浏览 813

c++题目,不知道错误怎么改,求大佬帮忙

#include
using namespace std;
class student
{
private:
string name,number;
int score[3];
int a,b,c;
public:
student()
{
}
void setint(string name,string number,int score[])
{
this->name=name;
this->number=number;
for(int i=0;i {
this->score[i]=score[i];
}
}
void judge(student B[])
{
for(int i=0;i<10;i++)
{
if(B[i].score[0]<B[i+1].score[0])
{
a=i+1;
}
if(B[i].score[1]<B[i+1].score[1])
{
b=i+1;
}
if(B[i].score[2]<B[i+1].score[2])
{
c=i+1;
}
}
cout<<B[a].score[0]<<" "<<B[a].name<<" "<<B[a].number<<endl;
cout<<B[b].score[1]<<" "<<B[b].name<<" "<<B[b].number<<endl;
cout<<B[c].score[2]<<" "<<B[c].name<<" "<<B[c].number<<endl;
}
};

int main()
{
string name,number;
int score[3];
student B;
student *A=new student[10];
for(int i=0;i {
cin>>name>>number;
for(int j=0;j {
cin>>score[j];
}
A[i].setint(name,number,score);
}
B.judge(A);
}

  • 写回答

1条回答 默认 最新

  • 傅里叶、 2017-06-12 12:45
    关注

    题目呢??????????????????????????????

    评论

报告相同问题?

悬赏问题

  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问