| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 832 人关注过本帖
标题:求助,这个程序哪里错了??
取消只看楼主 加入收藏
guowei3758
Rank: 2
来 自:陕西咸阳
等 级:论坛游民
帖 子:58
专家分:72
注 册:2010-4-9
结帖率:55.56%
收藏
已结贴  问题点数:10 回复次数:0 
求助,这个程序哪里错了??
#include<iostream>
#include<cstdlib>
using namespace std;
class date
{
private:
    int year;
    int month;
    int day;
public:
    date(int y,int m,int d)
    {
        cout<<"构造date"<<endl;
    }
    inline void copy(int y,int m,int d)
    {
        year=y;
        month=m;
        day=d;
    }
    inline void print2()
    {
        cout<<year<<"."<<month<<"."<<day<<endl;
    }
    ~date()
    {
    }
};
class people
{
private:
    long int number;
    char sex;
    char id[20];
    int y,m,d;
public:
    date b1(0,0,0);
    people()
    {
            number=0;sex='\0';
            y=m=d=0;
    }
    inline void xinxi()
    {
            cout<<"please input the number:";
            cin>>number;
            cout<<"please input the sex:(m/f)";
            cin>>sex;
            cout<<"please input the id:";
            cin>>id;
    }
    inline void birth()
    {
        cout<<"the birthday"<<endl;
        cout<<"please input the year:";
        cin>>y;
        cout<<"please input the month:";
        cin>>m;
        cout<<"please input the day:";
        cin>>d;
        b1.copy(y,m,d);
    }
    inline void print1()
    {
        cout<<number<<endl
            <<sex<<endl
            <<id<<endl;
        b1.print2();
    }
    ~people()
    {
    }
};
int main()
{
    int i,n;
    system("color 9e");
    people p1[1000];
    cout<<"How many people?";
    cin>>n;
    for(i=0;i<n;i++)
    {
        p1[i].xinxi();
        p1[i].birth();
    }
    for(i=0;i<n;i++)
    {
        p1[i].print1();
    }
    return 0;
}
哪里错了呢??
搜索更多相关主题的帖子: private include public people number 
2010-05-08 19:17
快速回复:求助,这个程序哪里错了??
数据加载中...
 
   



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

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