1004 成績排名

2021-09-22 21:02:05 字數 546 閱讀 9442

/*

*1.本題主要考察考察查詢元素

*2.考察結構體的定義

*struct studenttemp,ans_max,ans_min;

*定義三個結構體成員:學生名稱,id,成績,並定義三個結構體實體,temp,ans_max,ans_min;

*3.ans_max.score和ans_min.score儲存當前的最高分和最低分,因為成績區間為0-100,所以初始化時先令ans_max = -1,ans_min = 101。

* 1.

* 2.

*/#include using namespace std;

//定義學生結構體

struct studenttemp,ans_max,ans_min;

int main()

cout << ans_max.name << " " << ans_max.id << endl << ans_min.name << " " << ans_min.id;

return 0;

}

1004成績排名

讀入n名學生的姓名 學號 成績,分別輸出成績最高和成績最低學生的姓名和學號。輸入格式 每個測試輸入包含1個測試用例,格式為 第1行 正整數n 第2行 第1個學生的姓名 學號 成績 第3行 第2個學生的姓名 學號 成績 第n 1行 第n個學生的姓名 學號 成績其中姓名和學號均為不超過10個字元的字串,...

1004 成績排名

讀入n名學生的姓名 學號 成績,分別輸出成績最高和成績最低學生的姓名和學號。輸入格式 每個測試輸入包含1個測試用例,格式為 第1行 正整數n 第2行 第1個學生的姓名 學號 成績 第3行 第2個學生的姓名 學號 成績 第n 1行 第n個學生的姓名 學號 成績其中姓名和學號均為不超過10個字元的字串,...

1004 成績排名

這個相對來說比較簡單,但是沒能一次執行成功。要記得 結構體存資料取位址 include include include pragma warning disable 4996 int main struct student x scanf d n x struct student malloc n ...