张法森 • 5天前
#include <iostream> using namespace std; int main() { // 定义变量存储学号和成绩 int id, score; // 循环读取50个学生的信息 for (int i = 0; i < 50; ++i) { // 读取一行中的学号和成绩 cin >> id >> score; // 判断成绩是否≥80,满足则输出 if (score >= 80) { cout << id << " " << score << endl; } } return 0; }
评论: