練習9-1時間の変換

1の#include <stdio.hの>
 2  
3  構造体時間
 4  {
 5      int型の時間;
6      INT 分。
7      INT 第二;
8  }。
9  INTメイン(ボイド10  {
 11      INT N、TEMP;
12      構造体の時刻t1、
13  
14      のscanf(" %d個た:%d:%のD "、&​​t1.hour、&t1.minute、&t1.second)。
15      のscanf(" %d個"、&N)
16 
17      t1.second = t1.second + N。
18      TEMP = t1.second / 60 19      t1.second = t1.second%60 20  
21      t1.minute = t1.minute + TEMP。
22      TEMP = t1.minute / 60 23      t1.minute = t1.minute%60 24  
25      t1.hour = t1.hour + TEMP。
26      t1.hour = t1.hour%24 27  
28      のprintf(" %02D:%02D:%02D \ n " 、t1.hour、t1.minute、t1.second)。
29 
30      リターン 0 ;
31 }

おすすめ

転載: www.cnblogs.com/2018jason/p/12100203.html