| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 544 人关注过本帖
标题:VC出错。错在那啊,不懂,我新学啊
取消只看楼主 加入收藏
小子好学
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-5-16
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:0 
VC出错。错在那啊,不懂,我新学啊
#include <iostream>
#include<string>
using namespace std;
class teacher
{public:
    teacher(string nam,int a,string t)
{name=nam;
age=a;
title=t;}
void display()
{cout<<"name:"<<name<<endl;
cout<<"age:"<<age<<endl;
cout<<"title:"<<title<<endl;
}
protected:
    string name;
    int age;
    string title;
};
class student
{public:
student(char nam[],char s,float sco)
{strcpy(namel,nam);
 sex=s;
 score=sco;}
void display()
{cout<<"name:"<<namel<<endl;
 cout<<"sex:"<<sex<<endl;
 cout<<"score:"<<score<<endl;
}
protected:
    string namel;
    char sex;
    float score;
};
class graduate:public teacher,public student
{public:
graduate(string nam,int a,char s,string t,float sco,float w):
teacher(nam,a,t),student(nam,s,sco),wage(w){}
void show()
{cout<<"name:"<<namel<<endl;
 cout<<"age:"<<age<<endl;
cout<<"sex:"<<sex<<endl;
cout<<"score:"<<score<<endl;
cout<<"title:"<<title<<endl;
cout<<"wager:"<<wager<<endl;
}
private:
    float wage;
};
int main()
{graduate gradl("wang",24,'f',"assistant",1234.5,123.5);
gradl.show();
return 0;
}
2010-09-20 23:20
快速回复:VC出错。错在那啊,不懂,我新学啊
数据加载中...
 
   



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

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