国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

PAT BASIC 1004

2019-11-11 05:47:00
字體:
來源:轉載
供稿:網友

思路:

此題是比較簡單的一個模擬題,兩個struct類型的變量分別記錄第一名和最后一名,另一個變量輸入,每次輸入就判斷并更新第一名和最后一名的信息。

代碼:

#include<iostream>#include<string>using namespace std;struct Student{ string name; string id; int score;};int main(){ struct Student s, first, last; int n; first.score = -1; last.score = 101; cin >> n; for (int i = 0; i < n; i++) { cin >> s.name >> s.id >> s.score; if (s.score>first.score) first = s; if (s.score < last.score) last = s; } cout << first.name << " " << first.id << "/n"; cout << last.name << " " << last.id; //while (1) //{ //} return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巨野县| 长子县| 广丰县| 城市| 盐山县| 谢通门县| 南开区| 汤阴县| 桃园县| 新沂市| 双峰县| 蓝田县| 蒙自县| 城固县| 新泰市| 武冈市| 胶南市| 虎林市| 灵山县| 麻阳| 大渡口区| 江陵县| 祁阳县| 额济纳旗| 金塔县| 宝山区| 郸城县| 江津市| 玉门市| 雷波县| 子长县| 江门市| 甘孜| 武安市| 东乌珠穆沁旗| 时尚| 宜兴市| 静安区| 兴国县| 礼泉县| 太保市|