1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 class Time
 6 {
 7     public:
 8         Time(int,int,int);
 9         friend void display(Time&);
10     private:
11         int hour;
12         int minute;
13         int sec;
14 };
15 
16 Time::Time(int h,int m,int s)
17 {
18     hour=h;
19     minute=m;
20     sec=s;
21 }
22 
23 void display(Time&t)
24 {
25     cout<<t.hour<<":"<<t.minute<<":"<<t.sec<<endl;
26 }
27 int main(int argc, char** argv) {
28     Time t1(10,13,56);
29     display(t1);
30     return 0;
31 }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-08-13
  • 2021-09-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案