#include <stdio.h>
#include <stdlib.h>
void time(int,int*,int*,int*);
int main(int argc, char *argv[]) {
//define
int seconds,hours,min,sec;
//input
printf("please input an integer number of seconds:\n");
scanf("%d",&seconds);
//call the function
time(seconds,&hours,&min,&sec);
//output
printf("%dhours %dminutes %dseconds\n",hours,min,sec);
system("pause");
return 0;
}
void time(int a,int*h,int*m,int*s){
*h=a/3600;
*m=a/60-*h*60;
*s=a-*m*60-*h*3600;
}
C语言time函数,指针
最新推荐文章于 2023-09-05 13:14:11 发布