#include<iostream.h>
class Time{
private:
int hour;
int minute;
int second;
public:
Time(int h=0,int m=0,int s=0);
int get_hour();
int get_minute();
int get_second();
void set_time(int h=0,int m=0,int s=0);
void printtime();
}
Time::Time(int h=0,int m=0,int s=0)
{hour=h;munite=m;second=s;}
void Time::get_hour()
{return hour;}
void Time::get_minute()
{return minute;}
void Time::get_second()
{return second;}
void Time::set_time(int h=0,int m=0,int s=0)
{hour=h;minute=m;second=s;}
void Time::printtime()
{cout<<hour<<"."<<minute<<"."<<second<<endl;}
int main()
{Time time;
Time *pd;
pd=&time;
int m,n,p;
cout<<"请输入时间:"<<endl;
cin>>m>>n>>p;
pd->set_time(m,n,p);
return 0;
}
我 刚刚编好的有错误。。。。我找不出错误。。求指教。。 |