4.18
来源:互联网 发布:网络推广部门口号 编辑:程序博客网 时间:2024/06/05 14:30
在作业4.17的基础上,用学生类的对象指针作为参数,用一个循环选出最高成绩,一个循环输出最高成绩的学生的学号!
#include<iostream>using namespace std;class student{public:student(double a,int b){number=a;score=b;}int show();double show1();private:double number;int score;};int student::show(){return score;}double student::show1(){return number;}void max(student *p){int i;int big;big=p->show();for(i=1;i<6;i++){p++;if(big<p->show())big=p->show();}cout<<"最高成绩是:"<<big<<endl;for(int j=0;j<6;j++){if(big==p->show())cout<<"该学生的学号是:"<<p->show1()<<endl;p--;}}int main(){student stu[6]={student(01,96),student(02,100),student(03,70),student(04,60),student(05,50),student(06,80)};student *pr;pr=stu;max(pr);system("pause"); return 0; }
0 0
- 4.18
- 4.18
- 4.18
- 4.18
- 4.18
- 4.18
- 4.18
- 4.18
- 4.18
- 4.18
- 【4.18】
- 4.18
- 4.18
- 4.18
- 4.18
- 4.18
- Today 4.18
- 4.17 4.18
- Spring定时任务的简单例子
- 通过代码实现EXE文件图标的替换
- The sandbox is not sync with the Podfile
- rudy 方法 分析
- 递归算法
- 4.18
- 订单问题处理模式
- Mysql与Oracle区别
- zoj2432 hdoj1423 最长公共上升子序列(LCIS)
- 用多备份将网站数据备份到百度云,七牛云存储,阿里云OSS,亚马逊S3,金山云等云存储服务上
- 求两个数的最大公约数
- VBA第5课 select多条件判断
- 《Effective java》读书笔记——过期引用
- lua gc