3 #include <iostream. h struct clock i int hour int minute int second: 3 aclock void updata i aclock second++; if(aClock second==60 Raclock. second=0; a clock. minute++; 9 if(a clock. minute==60) a Clock, minute=0; aClockhour++; 1 if(aClockhour==24) a Clock hour=0; void display cout<<a Clockhour<<:<<a Clock.minute :<<a Clock. second<<endl; void maino i a clockhour-a Clock. minute=a Clock. second=0; for(inti=0;i<10000;i++) i updata; display o; 1 C++程序设计课件设计制作:徐龙琴C++程序设计课件 设计制作:徐龙琴 9 3 #include <iostream.h> struct clock { int hour; int minute; int second; } aClock; void updata() { aClock.second++; if(aClock.second==60) {aClock.second=0;aClock.minute++;} if(aClock.minute==60) { aClock.minute=0; aClock.hour++;} if(aClock.hour==24) aClock.hour=0; } void display() { cout<<aClock.hour<<":"<<aClock.minute <<":"<<aClock.second<<endl;} void main() { aClock.hour=aClock.minute=aClock.second=0; for(int i=0;i<10000;i++) { updata();display();} }