|
|
|
|
复制本帖HTML代码
|
高亮:
今天贴
X 昨天贴
X 前天贴
X |
#include <iostream.h>
#include "test.h"
// void increasement(Time &, const int);
main()
{
Time t;
t.sethour(17);
t.setmin(34);
t.setsec(25);
cout << "Result of setting all valid values:\n Hour: "
<< t.gethour()
<< " Minute: " << t.getmin()
<< " Second: " << t.getsec() <<"\n\n";
t.sethour(234);
t.setmin(43);
t.setsec(6373);
cout << "Result of attemping to set invalid hour and"
<< " second\n Hour: " << t.gethour()
<< " Minute: " << t.getmin()
<< " Second: " << t.getsec() <<"\n\n";
t.settime(11,58,0);
// increasement(t, 3);
return 0;
}
//void increasement (Time &tt, const int count)
//{
// cout << "Increasementing minute "<< count
// << " times:\nStart time: ";
// tt.printsta();
//
// for (int i = 1; i<= count ; i++)
// {
// tt.setmin((tt.getmin()+1)%60);
// if (tt.getmin()==0)
// tt.sethour((tt.gethour()+1)%24);
// cout << "\nminute +1: ";
// tt.printsta();
// }
// cout <<endl;
//}.
|
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法! |
|
|