| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 461 人关注过本帖
标题:怎么运行出错
取消只看楼主 加入收藏
nan1888
Rank: 2
等 级:论坛游民
帖 子:44
专家分:86
注 册:2011-6-19
结帖率:85.71%
收藏
 问题点数:0 回复次数:0 
怎么运行出错
#include  <iostream>
#include<string>
using namespace std;
class people
{ public:
char name[20];
int num;
int sex;
int num1;

people()
{num=0;
sex=0;
num1=0;
strcpy(name,"no name");
}
void set()
{cout<<"姓名"<<endl;
cin>>name;
cout<<"编号"<<endl;
cin>>num;
cout<<"性别"<<endl;
cin>>sex;
cout<<"身份证号"<<endl;
cin>>num1;
}
void show()
{cout<<"姓名"<<name<<endl;
cout<<"编号"<<num<<endl;
cout<<"性别"<<sex<<endl;
cout<<"身份证号"<<num1<<endl;
}
};



class student:virtual public people
{
public:
int sumtime4;
int weektime;
student():people()
{sumtime4=0;
weektime=0;}
void set()
{people::set();
cout<<"总学时数"<<endl;
cin>>sumtime4;
cout<<"周学时数"<<endl;
cin>>weektime;}

void show()
{cout<<"姓名"<<name<<endl;
cout<<"编号"<<num<<endl;
cout<<"性别"<<sex<<endl;
cout<<"身份证号"<<num1<<endl;
cout<<"总学时数"<<sumtime4<<endl;
cout<<"周学时数"<<weektime<<endl;}
};


class teacher:virtual public people

{public:
int teachtime;
int sumteach4;
teach():people()
{teachtime=0;
sumteach4=0;}
void set()
{people::set;
cout<<"总学时数"<<<<endl;
cin>>sumteach4;
cout<<"周学时数"<<<<endl;
cin>>teachtime;}
void show()
{cout<<"姓名"<<name<<endl;
cout<<"编号"<<num<<endl;
cout<<"性别"<<sex<<endl;
cout<<"身份证号"<<num1<<endl;
cout<<"总学时数"<<teachtime<<endl;
cout<<"周学时数"<<sumteach4<<endl;}
};


class graduate: virtual public student
{public:
int yantime;
int sumtime;
graduate():student()

{
yantime=0;
sumtime=0;
}
void set()
{student::set();
cout<<"周研究时间"<<endl;
cin>>yantime;
cout<<"总研究时间"<<endl;
cin>>sumtime;}

void show()
{cout<<"姓名"<<name<<endl;
cout<<"编号"<<num<<endl;
cout<<"性别"<<sex<<endl;
cout<<"身份证号"<<num1<<endl;
cout<<"总学时数"<<sumtime<<endl;
cout<<"周学时数"<<weektime<<endl;
cout<<"周研究时间"<<yantime<<endl;
cout<<"总研究时间"<<sumtime<<endl;
};
//添加程序

class TA:public  student,public teacher
{public:
int yantime;
int sumtime2;
TA():student():teacher()

{yantime=0;
sumtime=0;}
void set()
{cout<<"姓名"<<endl;
cin>>name;
cout<<"编号"<<endl;
cin>>num;
cout<<"性别"<<endl;
cin>>sex;
cout<<"身份证号"<<endl;
cin>>num1;
cout<<"总学时数"<<endl;
cin>>sumtime4;
cout<<"周学时数"<<endl;
xin>>weektime;
cout<<"周研究时间"<<endl;
cin>>yantime;

cout<<"总研究时间"<<endl;
cin>>sumtime2;
cout<<"周教学时间"<<endl
cin>>teachtime;
cout<<"总教学时间"<<endl;
cin>>sumtime;}

void show()
{cout<<"姓名"<<name<<endl;
cout<<"编号"<<num<<endl;
cout<<"性别"<<sex<<endl;
cout<<"身份证号"<<num1<<endl;
cout<<"总学时数"<<sumtime<<endl;
cout<<"周学时数"<<weektime<<endl;
cout<<"周研究时间"<<yantime<<endl;
cout<<"总研究时间"<<sumtime<<endl;
cout<<"周教学时间"<<teachtime<<endl;
cout<<"总教学时间"<<sumteach4<<endl;};

};
void main()
{teacher fgh();
fgh.set();
fgh.show;
}
搜索更多相关主题的帖子: 姓名 people 身份证号 
2011-06-30 20:42
快速回复:怎么运行出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016418 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved