C++作业4.17
来源:互联网 发布:什么叫软件开发 编辑:程序博客网 时间:2024/06/05 22:39
#include<iostream>
#include<string>
using namespace std;
class student
{
public:
student(int num1,float score1)
{
num=num1;
score=score1;
}
void print()
{
cout<<num<<" "<<score<<endl;
}
private:
int num;
float score;
};
int main()
{
student *p;
student a[6]={
student(01,98),
student(02,85),
student(03,90),
student(04,100),
student(05,84),
student(06,97)
};
p=a;
p++;
p->print();
p=p+2;
p->print();
p=p+2;
p->print();
return 0;
#include<string>
using namespace std;
class student
{
public:
student(int num1,float score1)
{
num=num1;
score=score1;
}
void print()
{
cout<<num<<" "<<score<<endl;
}
private:
int num;
float score;
};
int main()
{
student *p;
student a[6]={
student(01,98),
student(02,85),
student(03,90),
student(04,100),
student(05,84),
student(06,97)
};
p=a;
p++;
p->print();
p=p+2;
p->print();
p=p+2;
p->print();
return 0;
};
程序运行结果:
2 85
4 100
6 97
0 0
- c 作业
- c作业
- C作业
- c作业
- c作业
- c作业
- c作业
- c作业
- 【C语言】【unix c】作业 前台作业和后台作业
- C语言期中作业
- C语言期末作业
- C基础作业
- C语言小作业
- c语言作业2
- C语言小作业
- 第一次C程序设计作业
- 第一次C程序设计作业
- 第一次C程序设计作业
- JS绘制数学函数图
- 开发日记(2)drawable和bitmap和byte[]的相互转换
- maven 添加自己的包到本地仓库及到项目中
- 测试序列的特点
- sqoop1.99.3安装与教程
- C++作业4.17
- elasticsearchservicewrapper安装
- 进程间通信之WM_COPYDATA方式反思,回顾和总结
- c语言实现将一个整数转换为字符串
- URI和URL的区别
- Trick Collection
- 【java】微信支付生成签名的过程
- 语音转换成文字
- 【备用,将win执行程序转为安装程序】Winform打包和部署