[a] project to design a student class, the students the basic information of the student id, name, age, gender and class position (monitor, learning committee member, competitive person, and students), etc., by increasing the constructor, enables object when defining the data member is initialized, among them, the gender of the default value is "male", class position is "student" by default, specific requirements are as follows: (1) design the constructor, complete the initialization of object data members, among them, the data member is initialized using member initialization list, (2) to design a function points, student's class position for bonus points, if you don't points is normal, the monitor add 5 points, study committee and three points, competitive person add 2 points, (3) the design output function, the basic information of the output, and the student should add score, Please, no, is there any bosses give a help,
CodePudding user response:
It's too late to give you case tomorrow
CodePudding user response:
# include & lt; Iostream> #include using namespace std;
The class Student { Public: //id: student id //sName: name //iAge: age //sXb: gender, M: male, female F: //iZw: position, 0: students, 1 month, 2: learning committee member, 3: competitive person Student (string id, string sName, int iAge, string sXb="M", int iZhiwu=0). Void the print (); Private: Int getScore ();//receive points, without considering multiple position
String m_sId; String m_sName; Int m_iAge; String m_sXb; Int m_iZw; };
Int Student: : getScore () { Static int scores []=,5,3,2 {0};//score table, and position the serial number corresponding to the Return scores [m_iZw]; }
Int main (int arg c, char * argv []) { //example: female, learning committee member Student a (" 001 ", "Lili", 15, "F", 2); Amy polumbo rint (); return 0; }