使用对象数组和指针
来源:互联网 发布:linux命令vi怎么退出 编辑:程序博客网 时间:2024/06/05 17:05
/*烟台大学计算机学院学生*All right reserved.*文件名称:使用对象数组和指针*作者:孙玲倩*完成日期:2014年7月17日*版本号:v1.0*对任务及求解方法的描述部分:建立一个对象数组,内放5个学生的数据求5个学生中成绩最高者*我的程序:*/#include<iostream>using namespace std;class Student{ public: Student(int n,float s):num(n),score(s){} int num; float score;};int main(){ Student stud[5]={Student(101,78.5),Student(102,88.5),Student(103,98.5),Student(104,100.0),Student(105,95.5)}; void max(Student*); Student*p=&stud[0]; max(p); return 0;}void max(Student*arr){ float max_score=arr[0].score; int k=0; for(int i=1;i<5;i++) if(arr[i].score>max_score){max_score=arr[i].score;k=i;} cout<<arr[k].num<<" "<<max_score<<endl;}
0 0
- 使用对象数组和指针
- 对象数组和对象指针
- 对象数组和对象指针
- 对象数组和对象指针
- this指针和对象数组
- 数组、指针和字符串:对象指针
- 三十一、数组、指针和字符串:对象指针
- 指针数组和数组指针的使用
- 指针数组和数组指针的使用
- 数组指针和指针数组的使用
- 指针数组和数组指针的使用
- 指针数组和数组指针的使用
- 指针数组和数组指针的使用
- C++之对象数组和对象指针
- C++---对象数组和对象指针
- 数组和指针的使用
- c++的this指针和对象数组
- c++对象数组和this指针
- 栈与堆的区别及其探讨
- 一个即将面临大三的大学生(将要从事IT的屌丝男)自述
- 剑指offer
- 百度研发鄙视题
- LeetCode :: Sum Root to Leaf Numbers [tree、dfs]
- 使用对象数组和指针
- 项目开发中是突出的重点重要呢,还是细节重点重要.
- XML详解---1
- 生成验证码时出现Fatal error: Call to undefined function imagettftext()
- 【leetcode】Evaluate Reverse Polish Notation
- 设置Activity进入退出动画
- MySQL基本命令
- VC++ 鼠标事件、键盘事件模拟
- xml 解析