C++结构体之统计最高最低分
2014-08-04 11:42
204 查看
/* *Copyright (c) 2014 ,烟台大学计算机学院 *All rights reserved. *作者:张凤宁 *完成日期:2014年8月4 *版本号:v1.0 *问题描述: *样例输入: *样例输出: *问题分析:用简单的方法,学会活学活用 */ #include <iostream> using namespace std; struct Student { char name[20]; double score; }; int main() { Student stu[5]; Student a; for(int i=0; i<5; i++) { cin>>stu[i].name>>stu[i].score; } for(int j=0; j<4; j++) { for(int k=0; k<4-j; k++) { if(stu[k].score>stu[k+1].score) { a=stu[k]; stu[k]=stu[k+1]; stu[k+1]=a; } } } cout<<"MAX: "<<stu[4].name<<" "<<stu[4].score<<endl; cout<<endl; cout<<"MIN:"<<stu[0].name<<" "<<stu[0].score<<endl; return 0; }
相关文章推荐
- ojC++结构体之统计最高最低分
- OJ 2489 C++结构体之统计最高最低分
- oj--C++结构体之统计最高最低分
- oj刷题(坑题)Problem J: C++结构体之统计最高最低分
- C++结构体之统计最高最低分
- C++结构体之统计最高最低分
- oj2489: C++结构体之统计最高最低分
- C++结构体之统计最高最低分
- C++结构体之统计最高最低分
- C++结构体之统计最高最低分
- Problem F: C++结构体之统计最高最低分
- yt-2489: C++结构体之统计最高最低分
- [YTU]_2489( C++结构体之统计最高最低分)
- 输入一段英文文本,用程序统计出现频率最高和最低的两个单词;
- 统计最高最低分
- 2489OJ结构体之统计最高最低分
- 输出学生成绩。本题要求编写程序,根据输入学生的成绩,统计并输出学生的平均成绩、最高成绩和最低成绩。建议使用动态内存分配来实现。
- 【OJ】---I---结构体之统计最高最低分
- OJ结构体之统计最高最低分
- 16 oj 结构体统计最高最低分