| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1280 人关注过本帖
标题:新手求助 拷贝构造函数,内联成员函数,聚集?
取消只看楼主 加入收藏
guowei3758
Rank: 2
来 自:陕西咸阳
等 级:论坛游民
帖 子:58
专家分:72
注 册:2010-4-9
结帖率:55.56%
收藏
已结贴  问题点数:20 回复次数:3 
新手求助 拷贝构造函数,内联成员函数,聚集?
新手求助 拷贝构造函数,内联成员函数,聚集都是什么???
干什么的???
怎么用????
搜索更多相关主题的帖子: 内联 函数 构造 成员 
2010-05-02 16:12
guowei3758
Rank: 2
来 自:陕西咸阳
等 级:论坛游民
帖 子:58
专家分:72
注 册:2010-4-9
收藏
得分:0 
回复 2楼 温度
可否具体点啊。。。。。。这些都怎么用啊??
2010-05-03 11:14
guowei3758
Rank: 2
来 自:陕西咸阳
等 级:论坛游民
帖 子:58
专家分:72
注 册:2010-4-9
收藏
得分:0 
#include<iostream>
using namespace std;
enum paople_sex{m,f};
class date
{
private:
    int year;
    int month;
    int day;
public:
    date(int year,int month,int day);
    void birth()
    {
        cout<<"the birthday"<<endl;
        cout<<"please input the year:";
        cin>>year;
        cout<<"please input the month:";
        cin>>month;
        cout<<"please input the day:";
        cin>>day;
    }
    void print2()
    {
        cout<<year<<"."<<month<<"."<<day<<endl;
    }
    ~date();
};
class people
{
private:
    long int number;
    char sex;
    char id[20];
public:
    date b1;
    date b2(b1);
    people(long int number,char sex,char id[20]);
    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;
            b1.birth();
    }
    void print1()
    {
        cout<<number<<endl
            <<sex<<endl
            <<id<<endl;
        b2.print2();
    }
    ~people();
};
void main()
{
    int i,n;
    system("color 9e");
    people p1[1000];
    people p2[1000](p1[1000]);
    cout<<"How many people?";
    cin>>n;
    for(i=0;i<n;i++)
    {
        p1[i].xinxi();
    }
    for(i=0;i<n;i++)
    {
        p2[i].print1();
    }
}
这个程序是输入员工信息,再输出(要求用到构造,析构,内联,拷贝构造,聚集)
貌似问题很严重
请各位帮忙改一下,先谢谢了
2010-05-03 22:35
guowei3758
Rank: 2
来 自:陕西咸阳
等 级:论坛游民
帖 子:58
专家分:72
注 册:2010-4-9
收藏
得分:0 
呵呵,又学到了不少东西
另外,我用的是VC++,在用system("color 9e")时,好像不用加头文件,
而且在main前也可以用void,不过的确还是应该写标准的,我记住了,多谢了
2010-05-04 17:45
快速回复:新手求助 拷贝构造函数,内联成员函数,聚集?
数据加载中...
 
   



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

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