#include unsigned longseconds(int h,int m,int s){ unsigned longss=0; ss=s+60*m+60*60*h; return ss;}void main(void){ int h,m,s; unsigned longse; scanf("%d%d%d",&h,&m,&s);//输入时间,最好加以判断,以防用户输入错误的时间分秒数.这里没有判断 se=seconds(h,m,s);//调用函数,返回秒值printf("h:%d m:%d s:%d\n",h,m,s); printf("%ld",se);}
|