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 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算