编程作业,请懂的朋友帮帮忙

2022-04-13 社会 77阅读

#include

#include

#include

usingnamespacestd;

staticp=0;

classScore

{

public:

floatcomputer;

floatenglish;

floatmathematics;

floattotal;

Score()

{

computer=0;

english=0;

mathematics=0;

}

Score(floata,floatb,floatc)

{

computer=a;

english=b;

mathematics=c;

total=0;

}

voidsum() 

{

total=computer+english+mathematics;

}

voidprint()

{

cout

}

voidmodify()

{

cin>>computer>>english>>mathematics;

}

};

classStudent

{

public:

intnumber;

stringname;

Scoreascore;

Student(){}

Student(intd,stringe,floatf,floatg,floato):

ascore(f,g,o)

{

number=d;

name=e;

}

voidsum()

{

ascore.sum();

}

voidprint()

{ if(p==0)

cout

cout

cout

cout

cout

p++;

}

voidmodify()

{

cin>>number>>name;

ascore.modify();

}


};

intmain(void)

{

inti;

Students[2];

for(i=0;i

{

s[i].modify();

s[i].sum();

}

for(i=0;i

s[i].print();

return0;

}

声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com