学生情報システムの完全版
#include
using namespace std;
class Student // ;
{
string name;
int no;
int score[3];
float average;
int order;
public:
Student(int id,string na,int x,int y,int z):name(na),no(id)
{
score[0]=x, score[1]=y, score[2]=z;
order=-1,average=((score[0]+score[2]+score[1])/3);
}
Student()
{
score[0]=score[1]=score[2]=0;
order=-1,average=0;
}
void setName(string name) {this->name=name;}
string getName() {return name;}
int setN0(int n) {no=n;}
int getNO() { return no;}
int setscore0(int i)
{
score[0]=i;
average=((score[0]+score[2]+score[1])/3);
}
int setscore1(int j)
{
score[1]=j;
average=((score[0]+score[2]+score[1])/3);
}
int setscore2(int k)
{
score[2]=k;
average=((score[0]+score[2]+score[1])/3);
}
int getscore0() {return score[0];}
int getscore1() {return score[1];}
int getscore2() {return score[2];}
float getAverage() {return average;}
void setAverage(int avg) {average=avg;}
void setOrder(int x) {order=x;}
int getOrder() {return order;}
void display();
};
void Student::display()
{
cout<=1e-9)
return 1;
else
return 0;
}
bool cmp2(Student stu1,Student stu2)
{
return stu1.getNO()>no)&&no!=-1)
{
cin>>name>>x>>y>>z;
Student s(no,name,x,y,z);
list[n++]=s; // ;
sortlist();
}
}
void Operation::sortlist() // , ;
{
sort(list,list+n,cmp1); // ;
for(int i=0;i>no&&no!=-1)
{
i=search(no);
if(i!=-1)
{
cout<>no&&no!=-1)
{
i=search(no);
if(i!=-1)
{
cout<>f;
if(f==0)
{
cin>>a;
list[i].setscore0(a);
sortlist();
}
if(f==1)
{
cin>>b;
list[i].setscore1(b);
sortlist();
}
if(f==2)
{
cin>>c;
list[i].setscore2(c);
sortlist();
}
cout<>no&&no!=-1)
{
i=search(no);
if(i!=-1)
{
for(j=i;j
コンパイル結果:1112を削除中にエラーが発生しましたか?
、 、 、 、c++ , -1
1111 ming 10 20 30
1112 xing 20 30 40
1113 tian 30 40 50
-1
c++
tian 1113 30 40 50 40 1
xing 1112 20 30 40 30 2
ming 1111 10 20 30 20 3
, -1
1112
c++
ming 1111 10 20 30 20 3
, -1 1111
c++
6879680 0 0 0 0 -1
, -1 1113
c++
6879680 0 0 0 0 -1
, -1