Home > Back-end >  O bosses (e0289)
O bosses (e0289)

Time:10-07

#include using namespace std;//define students Studentclass Student {int no;//student id char name [10].//the name double score;//performance static int totalNumber;//the total number of students static double totalScore;//overall static double lowestScore;//the lowest scores static double highestScore;//the highest grade public: Student (int no_, char * name_, double score_);//the constructor static void the Output ();//output information function void StudentInformation ();//output of basic information function}; Int Student: : totalNumber=0;//static data members initialized double Student: : totalScore=0; Double Student: : highestScore=0. Double Student: : lowestScore=100. Int main () {Student stu1 (1, "zhang", 97.5); Stu1. StudentInformation (); Student stu2 (2, "bill", 83); Stu2. StudentInformation (); Student stu3 (3, "detective", 93.); Stu3. StudentInformation (); Student stu4 (4, "guo six", 62.5); Stu4. StudentInformation (); Student stu5 (5, "former seven", 77.); Stu5. StudentInformation (); Student: the Output (); return 0; } Student: : Student (int no_, char * name_, double score_) {no=no_; Strcpy (name, name_); Score=score_; TotalNumber++; TotalScore +=score; If (score & gt; HighestScore) highestScore=score; If (score & lt; LowestScore) lowestScore=score; } void Student: : StudentInformation () {cout & lt; <"Student id:" & lt; CodePudding user response:

Char name [10]. Become a const char name [10] to go, if there is wrong, which you will prompt you to add const
  • Related