oj学生数组
来源:互联网 发布:有了源码如何建站 编辑:程序博客网 时间:2024/05/18 00:01
问题:
//建立一个对象数组,内放n(n<10)个学生的数据(学号、成绩),用指针指向数组首元素,输出第奇数(1,3,5,7)个学生的数据。
程序:
#include <iostream>#include <iomanip>using namespace std;class Student{private: int num; double grade;public: void input() { cin>>num>>grade; } void display() { cout<<num<<" "<<grade<<endl; }};int main(){ const int NUM=10; Student stud[NUM]; int n,i; cin>>n; for(i=0; i<n; i++) stud[i].input(); cout<<setiosflags(ios::fixed); cout<<setprecision(2); Student *p=stud; for(i=0; i<n; p+=2,i+=2) p->display(); return 0;}
结果:
0 0
- oj学生数组
- oj学生类
- oj-输出学生信息
- 两个学生OJ差集
- 高于均分的学生 oj
- oj-16-C-学生系统
- 数组学生管理
- 学生信息管理(数组)
- 学生成绩数组求学生排名
- 天勤OJ 题目1405: 学生查询
- 九度OJ 1069: 查找学生信息
- 【OJ】(二)---H---输出学生信息
- OJ 67之学生成绩管理
- OJ 68之学生结构体链表
- YTU-OJ-静态成员---计算学生个数
- 九度OJ 1069 查找学生信息
- 第十三周 Oj 学生成绩的处理
- 第13周 oj 学生成绩处理
- 程序优化-基本优化(我的总结)
- C# 操作MSSQL数据库类(winform)
- hdu1043Eight (经典的八数码)(康托展开+BFS)
- DNS 安全信息 (微软)
- Solr索引增删改查
- oj学生数组
- Ural 1519. Formula 1 优美的插头DP
- zookeeper的领导者选举和原子广播
- Object Literals(提供了很棒的语法糖)
- c htoi
- C#中的关键字学习:delegate(委托)和volatile
- 学习理论和动手实践
- 面试杂题(七)二维数组中寻找
- POJ 2362 Square(DFS回溯构造)