c++类与对象:1)要求定义一个学生(student)类,包含数据成员:学号(sno),年龄(age),分数(score)..

[复制链接]
查看11 | 回复1 | 2010-10-26 22:39:18 | 显示全部楼层 |阅读模式
以及成员函数:输入(input),和显示(print)。然后定义一个具有10个学生的数组,实现对这些学生信息的输入和显示....
2)定义一个友员函数output,实现和成员函数print相同的功能.....
明天要交实验报告,麻烦那位大哥帮小弟一把,感激不尽.....

回复

使用道具 举报

千问 | 2010-10-26 22:39:18 | 显示全部楼层
#include #include #defineN 10using namespace std;class student{private: string sno; int
age; float score;public: void Input(); void Print();friend void output(student &a);};void student::Input(){cin>>sno>>age>>score;}void student::Print(){ cout<<"num
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行