class Time{int hour,minute,second;public:Time(int a=0,int b=0,int c=0){hour=a;minute=b;second=c;}void setTime(int a,int b,int c){hour=a;minute=b;second=c;}void getTime(char*p){char s[1000];char z[1]={':'};itoa(hour,s);strcat(p,s);strcat(p,z);itoa(minute,s);strcat(p,s);strcat(p,z);itoa(second,s);strcat(p,s);}};void itoa(int n,char *s) //普通函数{char a[1000];char *m=a;for(;n!=0;m++){*m=n%10 + '0';n=n/10;}for(;m!=a;s++)*s=*(--m);}
- 1 回答
- 0 关注
- 90 浏览
添加回答
举报
0/150
提交
取消