| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 450 人关注过本帖
标题:求助
只看楼主 加入收藏
祸莫大于轻敌
Rank: 1
等 级:新手上路
帖 子:14
专家分:3
注 册:2012-11-2
收藏
 问题点数:0 回复次数:3 
求助
帮忙看一下这个程序哪里出错了。


#include <iostream>
#include <string>
using namespace std;
class Base
{
protected:
    string name;
    int year,month,day;
    string bithplace;
public:
    Base(string na,int y,int m,int d,string bp)
    {
        name=na;
        year=y;
        month=m;
        day=d;
        bithplace=bp;
    }
    void SetName()
    {
        cout<<"请输入姓名:"<<endl;
        cin>>name;
    }
    void SetDate()
    {
           cout<<"请输入出生年月:"<<endl;
           cin>>year;
        cin>>month;
        cin>>day;
    }
   
    void SetBithPlace()
    {
        cout<<"请输入出生地址:"<<endl;
        cin>>bithplace;
    }
    void GetName(string &)
    {
        cout<<"name:"<<name<<endl;
    }
    void GetDate(int &,int &,int &)
    {
        cout<<"BithDate:"<<year<<"/"<<month<<"/"<<day<<endl;
    }
    void GetBithPlace(string &)
    {
        cout<<"BithPlace:"<<bithplace<<endl;
    }
};
class AllChil:public Base
{
protected:
    char sex;
public:
    AllChil(string na,int y,int m,int d,string bp,char s):
      Base(na,y,m,d,bp)
      {sex=s;}
      void SetAllChil(string na,int y,int m,int d,string bp,char s)
      {
         void SetName();
         void SetDate();
         void SetBithPlace();
         cout<<"请输入性别:"<<endl;
         cin>>sex;
      }
      void GetAllChil(string &,int &,int &,int &,string &,char &)
      {
          void GetName();
          void GetDate();
          void GetBithPlace();
          cout<<"sex:"<<sex<<endl;
      }
};
class Preschool:public AllChil
{
protected:
    int age;
public:
    Preschool(string na,int y,int m,int d,string bp,char s,int a):
      AllChil(na,y,m,d,bp,s)
      {age=a;}
      void SetPreschool(string na,int y,int m,int d,string bp,char s,int a)
      {
          void SetAllChil();
          cout<<"请输入年龄:"<<endl;
          cin>>age;
      }
      void GetPreschool(string &,int &,int &,int &,string &,char &,int &)
      {
          void GetAllChil();
          cout<<"age:"<<age<<endl;
      }
};
class Schoolage:public AllChil
{
protected:
    string school;
    int num;
public:
    Schoolage(string na,int y,int m,int d,string bp,char s,string sc,int n):
      AllChil(na,y,m,d,bp,s)
      {
          school=sc;
          num=n;
      }
      void SetPreschool(string na,int y,int m,int d,string bp,char s,string sc,int n)
      {
          void SetAllChil();
          cout<<"请输入学校:"<<endl;
          cin>>school;
          cout<<"请输入学号:"<<endl;
          cin>>num;
      }
      void GetSchoolage(string &,int &,int &,int &,string &,char &,string &,int &)
      {
          void GetAllChil();
          cout<<"school:"<<school<<endl;
          cout<<"num:"<<num<<endl;
      }
};
class Men:public Base
{
protected:
    string danw;
    float wage;
    int tel;
public:
    Men(string na,int y,int m,int d,string bp,string dw,float w,int t):
        Base(na,y,m,d,bp)
    {
        danw=dw;
        wage=w;
        tel=t;
    }
    void SetMen(string na,int y,int m,int d,string bp,string dw,float w,int t)
    {
        void SetName();
        void SetDate();
        void SetBithPlace();
        cout<<"请输入单位:"<<endl;
        cin>>danw;
        cout<<"请输入工资:"<<endl;
        cin>>wage;
        cout<<"请输入电话:"<<endl;
        cin>>tel;
    }
    void GetMen(string &,int &,int &,int &,string &,string &,float &,int &)
    {
        void GetName();
        void GetDate();
        void GetBithPlace();
        cout<<"danw:"<<danw<<endl;
        cout<<"wage:"<<wage<<endl;
        cout<<"tel:"<<tel<<endl;
    }
};
class OldMen:public Base
{
protected:
    float twage;
    string like;
public:
    OldMen(string na,int y,int m,int d,string bp,float tw,string l):
          Base(na,y,m,d,bp)
    {
        twage=tw;
        like=l;
    }
    void SetOldMen(string na,int y,int m,int d,string bp,float tw,string l)
    {
        void SetName();
        void SetDate();
        void SetBithPlace();
        cout<<"请输入退休工资:"<<endl;
        cin>>twage;
        cout<<"请输入业余爱好:"<<endl;
        cin>>like;
    }
    void GetMen(string &,int &,int &,int &,string &,float &,string &)
    {
        void GetName();
        void GetDate();
        void GetBithPlace();
        cout<<"twage:"<<twage<<endl;
        cout<<"like:"<<like<<endl;
    }
};
int main()
{
    system("COLOR 2b");
    AllChil all("nan",12,2,2,"dsdf",'f');
    cout<<"有关监护人信息的输入和输出:"<<endl;
   // all.SetAllChil();
    //all.GetAllChil();
    cout<<"有关学龄前信息的输入和输出:"<<endl;
    void SetPreschool();
    void GetPreschool();
    cout<<"有关学龄期信息的输入和输出:"<<endl;
    void SetSchoolage();
    void GetSchoolage();
    cout<<"有关成人信息的输入和输出:"<<endl;
    void SetMen();
    void GetMen();
    cout<<"有关老年人信息的输入和输出:"<<endl;
    void SetOldMen();
    void GetOldMen();
    return 0;
}
搜索更多相关主题的帖子: void include public 
2012-11-23 16:01
mmmmmmmmmmmm
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:8
帖 子:388
专家分:1809
注 册:2012-11-2
收藏
得分:0 
system("COLOR 2b");
这段代码牛

我们的目标只有一个:消灭0回复!
while(1)
++money;
2012-11-23 16:31
mmmmmmmmmmmm
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:8
帖 子:388
专家分:1809
注 册:2012-11-2
收藏
得分:0 
调用函数是不是应该如下:
 all.SetAllChil("nan",12,2,2,"dsdf",'f');

我们的目标只有一个:消灭0回复!
while(1)
++money;
2012-11-23 16:40
祸莫大于轻敌
Rank: 1
等 级:新手上路
帖 子:14
专家分:3
注 册:2012-11-2
收藏
得分:0 
谢了。。
2012-11-24 22:07
快速回复:求助
数据加载中...
 
   



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

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