游客:
注册
|
登录
|
搜索
|
帮助
3s地带
»
软件应用
» VC编程题
‹‹ 上一主题
|
下一主题 ››
投票
交易
悬赏
活动
打印
|
推荐
|
订阅
|
收藏
标题: VC编程题
HiiI
强风
UID 5159
精华 0
积分 93
帖子 23
现金 83
贡献值 0
阅读权限 30
注册 2007-8-24
楼主
大
中
小
发表于 2007-9-2 17:31
资料
个人空间
短消息
加为好友
VC编程题
定义一个描述学生基本情况的类,数据成员包括姓名,学号,C++,英语和数学成绩,成员包括输出数据、置姓名和学号,置3门课的成绩,求出总成绩和平均成绩
frfixi
强风
UID 3844
精华 0
积分 52
帖子 10
现金 42
贡献值 0
阅读权限 30
注册 2007-8-24
沙发
大
中
小
发表于 2007-9-2 17:31
资料
个人空间
短消息
加为好友
#include "iostream"
using namespace std;
class Student
{
private:
char name[10];
char id[20];
float C_result;
float Eng_result;
float Math_result;
public:
void show_info() //输出数据
{
cout<<name<<":"<<id<<" C++:"<<C_result<<" Eng:"<<Eng_result<<" Math:"<<Math_result<<endl;
}
void input_info()//置姓名和学号
{
cout<<"输入姓名:";
cin>>name;
cout<<"输入学号:";
cin>>id;
}
void input_result()//置3门课的成绩
{
cout<<"输入C++成绩:";
cin>>C_result;
cout<<"输入英语成绩:";
cin>>Eng_result;
cout<<"输入数学成绩:";
cin>>Math_result;
}
void input_result( float a, float b,float c)//用参数置3门课的成绩
{
C_result=a;
Eng_result=b;
Math_result=c;
}
float get_cout()//求出总成绩
{
return (C_result+Eng_result+Math_result);
}
float get_avrg()//取得平均成绩
{
return (C_result+Eng_result+Math_result)/3.0;
}
};
投票
交易
悬赏
活动
控制面板首页
编辑个人资料
积分交易
公众用户组
好友列表
个人空间管理
升级个人空间
当前时区 GMT+8, 现在时间是 2008-12-2 12:39
清除 Cookies
-
联系我们
-
3S地带
-
Archiver
-
WAP
-
赣ICP备07006302号
界面风格
----------
DST_lovelylook
默认风格
D5MSNCool
Powered by
Discuz!
5.5.0
©
Processed in 0.024728 second(s), 6 queries , Gzip enabled