定义一个学生类,有姓名、学号、性别、四门功课(math、english、C、Computer)和平均分等私有数据成员;

[复制链接]
查看11 | 回复2 | 2011-6-21 15:29:38 | 显示全部楼层 |阅读模式
.用对象指针实现(即链表);
2.用构造函数实现学生信息的输入;
3.平均分的计算要用一个单独的函数实现;
4.请严格按照下面的格式进行输入输出。
输入/输出样式:
Please Input the Number of Students:
3
Please input 3 student info: NameIDSexMath English CComputer
wang 1 f 80 80 80 80
zhang 2 m 85 85 85 85
liang 3 m 75 75 75 75
Student Information:
NameIDSexMathEnglishCComputerAverage
wang1f8080808080
zhang2m8585858585
liang3m7575757575

回复

使用道具 举报

千问 | 2011-6-21 15:29:38 | 显示全部楼层
#include#includeclass student{private:char name[20];int ID;char sex;int score[4];
int aver;class student *next;public:
student();~student();void creatlinklist(student *);void average();void print();};student::student(){int i;cin>>this->name>>this->ID>>...
回复

使用道具 举报

千问 | 2011-6-21 15:29:38 | 显示全部楼层
参考资料中还有其它可用代码。#includeusing namespace std;class student{private: char *name; int id; char sex; double math,english,C,Computer; double ave;public: ...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行