分清“你我”
#include <iostream>
using namespace std;
class Time
{
public:
void set_time(int,int,int);
void show_time();
private:
int hour;
int minute;
int sec;
};
int main( )
{
Time t1,t2;
t1.set_time(12,45,32);
t2.set_time(21,32,15);
t1.show_time();
t2.show_time( );
return 0;
}
void Time::set_time(int h,int m,int s)
{
hour=h;
minute=m;
sec=s;
}
void Time::show_time()
{
cout<<hour<<":";
cout<<minute<<":";
cout<<sec<<endl;
}