-->
当前位置:首页 > 题库

PROGRAMMING:Calculation of students' CPP scores

Luz5年前 (2021-05-10)题库621
The framework of human base class is given as follows
class Person
{
protected:
string name;
int age;
public:
Person();
Person (string p_ name, int p_ age);
void display () {cout<};
Create a derived class student and add the following member data:
int ID;// Student number
float cpp_ score;// CPP computer performance
float cpp_ count;// CPP attendance
float cpp_ grade;// CPP score
//Calculation rule of total score: CPP_ grade = cpp_ score * 0.9 + cpp_ count * 2;
Add the following member functions:
Nonparametric constructor of student class
Parameterized constructor of student class / / pay attention to CPP_ Grade is the result of computer performance and attendance
Void print() / / output the current student information
//CPP_ The grade output retains one decimal place
//The output format is ID name CPP_ grade
Generate the above class and write the main function, according to the basic information of students, establish a student object, calculate its CPP total score, and output its student number, name, total score.
Input format: the test input contains several test cases, and each test case occupies one line (student name, student number, age, CPP score, CPP attendance). When 0 is read in, the input ends and the corresponding result is not output.
Input example:
Bob 10001 18 75.5 4
Mike 10005 17 95.0 5
0
Output example:
10001 Bob 75.9
10005 Mike 95.5






answer:If there is no answer, please comment