Home > Back-end >  Turn to the great god, add code c
Turn to the great god, add code c

Time:10-02

Student information system requirements to build a student class, students classes including name, student number, age, math, English, total 6 data members and member functions, the main function through the keyboard in getting the names of the three students, student id, age, math, English, by setting the student information member function to set the student's name, student number, age, math, English, In calculating total score member function computing students score, and the function of the members in the output shown in the student's name, student number, age, math, English, total score, part of the code is as follows, please will complete the program, running effect as shown in the figure below:



#include

#include

#include

using namespace std;



The class CStudent {

Private:

Char Name [21].

Int Num.

Int the Age;

Float MathS;

Float EngS;

Float the TotalS.

Public:

Void SetInfo (char * na, int num, int the age, float math, float eng);

Void TotalScore ();//calculate students overall

Void the OutPut ()//OutPut student information

{

Cout
...

Cout
}

};

Void CStudent: : SetInfo (char * na, int num, int the age, float math, float eng)

{

...

EngS=eng;



}



Void CStudent: : TotalScore ()

{

...

}



Int main ()

{

CStudent stu [3].

Char Na [21].

Int Nu;

Int Ag;

Float MS;

Float ES.

Cout<& lt;" Input student information: "& lt;
for(int i=0; I<3; I++)

{

cin> Na;

cin> Nu.

cin> Ag.

cin> MS;

cin> ES.

...

}

Cout<& lt;" Output student information: "& lt;
Cout<& lt;" The name "& lt; & lt;" Student id "& lt; & lt;" Age "& lt; & lt;" English & lt; & lt;" Mathematics & lt;" & lt;" Total score "& lt;
for(int i=0; I<3; I++)

{

...

}

return 0;

}
  • Related