Toggle navigation
Courses
問題
標籤
用戶
04-06 Lab exercise 1: Structure to handle Time
0
喜歡
0
不喜歡
5.4k
瀏覽
Write a program with following requirements:
Define the
structure
type time with fields: hours, minutes, and seconds.
Write a function that takes an integer as parameter and converts that integer (as seconds) to hours, minutes, and seconds. These values should be stored into the fields of a structure of type time, and
the function should return that structure
.
Write a program that reads an integer, calls the function, and displays the fields of the returned structure.
Example input:
7776
Example output:
2:9:36
[練習]
Coding (C)
-
最新提問
4月 6, 2017
分類:
C
|
ID: 23557 -
從幾時開始:
無限制
-
到幾時結束:
無限制
|
5.4k
瀏覽
評論
0
0
Called for Help
請
登錄
或者
註冊
後再添加評論。
32
個回答
0
喜歡
0
不喜歡
內容已隱藏#include * * * **
*** *** *** ** * * * *
struct Clock{
*** * ** * * ** * * hours;
* ** * ** ** * * ** * **** * minutes;
**** * * * ** * * * * *** * seconds;
};
int main(){
** * * *** * ** * * * * input;
** * ** ** * * ** * *** * ** **** Clock * ***
* ** * * * ** * * * * * * * ** * * * * * *
***** ** * * * * * * * ** * * ** * = input / 3600;
* * * * * * ** ** * * * * = (input % 3600) / 60;
* ****** * * * * * * = (input % 3600) % 60;