c++ 一道类的组合的题目,急求解答,谢谢了

#include<iostream>
using namespace std;
class period
{
protected:
int year;
int month;
int day;
public:
void input1()
{
cin>>year>>month>>day;
}
void output1()
{
cout<<year<<" "<<month<<" "<<day;
}
};

class time
{
protected:
int hour;
int minute;
int second;
public:
void input2()
{
cin>>hour>>minute>>second;
}
void output2()
{
cout<<hour<<" "<<minute<<" "<<second;
}
};

class arrangement
{
int n;
period m1;
time m2;
public:
void input3()
{
cin>>n;
m1.input1();
m2.input2();
}
void output3()
{
m1.output1();
m2.output2();
}
};

int main()
{
period p1;
time p2;
arrangement p3;

cout<<"请输入年 月 日"<<endl;
p1.input1();
cout<<"请输入时 分 秒"<<endl;
p2.input2();
cout<<"请输入事件安排的编号 年 月 日 时 分 秒"<<endl;
p3.input3();
cout<<"c++作业上传于";p1.output1();p2.output2();cout<<endl;
cout<<"c++作业截至于";p3.output3();cout<<endl;
return 0;
}

8.cpp:41: error: ‘time’ does not name a type
8.cpp: In member function ‘void arrangement::input3()’:
8.cpp:47: error: ‘m2’ was not declared in this scope
8.cpp: In member function ‘void arrangement::output3()’:
8.cpp:52: error: ‘m2’ was not declared in this scope
8.cpp: In function ‘int main()’:
8.cpp:59: error: expected ‘;’ before ‘p2’
8.cpp:59: warning: statement is a reference, not call, to function ‘time’
8.cpp:59: warning: statement has no effect
8.cpp:65: error: ‘p2’ was not declared in this scope

8.cpp:41: error: ‘time’ 没有定义
8.cpp: In member function ‘void arrangement::input3()’:
8.cpp:47: error: ‘m2’ 没声明
8.cpp: ‘void 成员中arrangement::output3()’:
8.cpp:52: error: ‘m2’ 没声明
8.cpp: 定义‘int main()’:
8.cpp:59 ‘p2’前没有 ‘;’
8.cpp:59: warning:声明不能CALL 或者function ‘time’
8.cpp:59: warning: 声明无效
8.cpp:65: error: ‘p2’ 没声明
CONST函数内部不能调用非CONST函数
一大堆函数没声明 要引用的又不引用 API又不declare
还有那个void成员都没有的都调用

重写吧 晕死 你那里复制人家的代码
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-05-16
编译了一下,没事啊,代码没问题,你看看你编译的文件是不是该文件的,有时候打开了别的代码就编译,根本没拷进工程里
第2个回答  2012-05-16
先在源程序中标出行数来吧
第3个回答  2012-05-15
运行好着啊
第4个回答  2012-05-30
朋友,你用的是什么编译器?用G++试试,肯定能运行
相似回答