怎么加易烊千玺微信号:C语言问题

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 01:34:23
输入一个时间值,如X时X分X秒,计算出该时刻是第几秒?要用结构体来做的,用那个struct来做

#include<stdio.h>
struct shijian
{
int h;
int m;
int s;
};

void main()
{
struct shijian sj;
printf("Input time : h m s");
scanf("%d%d%d",&sj.h,&sj.m,&sj.s);
int q=(24*sj.h+sj.m)*60+sj.s;
printf("This is the %d s",q);
}
已运行通过