按照以下格式任意输入两个学生的学号、姓名和成绩,输出成绩较高的学生的学号、姓名和成绩。若成绩相等,则两个学生都输出。
#includeiostreamusingnamespacestd;structperson{stringxuehao,xingming;intchengji;}student1,student2;intmain(){cout学号|姓名|成绩\n;cinstudent1.xuehaostudent1.xingmingstudent1.chengjistudent2.xuehaostudent2.xingmingstudent2.chengji;cout成绩较高的是:;if(student1.chengjistudent2.chengji)coutstudent2.xuehaostudent2.xingmingstudent2.chengji;elseif(student1.chengji==student2.chengji)coutstudent1.xuehaostudent1.xingmingstudent1.chengji\nstudent2.xuehaostudent2.xingmingstudent2.chengji;elsecoutstudent2.xuehaostudent2.xingmingstudent2.chengji;return0;}