第五周任務4 學生「類」

2021-06-05 06:03:01 字數 517 閱讀 7267

#includeusing namespace std;

class student

void display();

int get_num()

float get_score()

private:

int num;

float score;

};void student::display()

cout<

cout << a[k].get_num() << endl;

cout << "成績是:" << endl;

cout << a[k].get_score() << endl;

return 0;

} int main()

; student *p=s;

for(int i=0;i<5;i=i+2)

max(s);

return 0;

system("pause");

}

第五周 任務四

對任務及求解方法的描述部分 輸入描述 問題描述 程式輸出 程式頭部的注釋結束 include using namespace std class student void display int num float score int main student p stud cout void ma...

第五周 任務四

任務4 設計乙個學生類,包括學號 num 和成績 score 建立乙個物件陣列,內放5個學生的資料,要求 1 用指標指向陣列首元素,輸出第1 3 5個學生的資訊 2 設計乙個函式max,用指向物件的指標作函式引數,在max函式中找出5個學生中成績最高者,並輸出其學號。includeusing nam...

第五周任務1 4

程式頭部注釋開始 include includeusing namespace std class float perimeter void 計算三角形的周長 float area void 計算並返回三角形的面積 void showmessage private float a,b,c 三邊為私有...