0 喜歡 0 不喜歡
5k 瀏覽

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) - 最新提問 分類:C |
ID: 23557 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 5k 瀏覽
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;


* ** **** * ** *** * ** * ** *** ** *** * *** * * * ** ** * * *** **
* * **** ** ***** * * ** ** 0;

}
最新回答 用戶: (-218 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * * ** ***
*** * ** **



struct Clock{
***** * * **** * ** *** hours;
** * ** * * ***** minutes;
* * ** * ** * seconds;

};



int main(){
** * * * * ** * * * ** input;
* ** * * * * * * * ** Clock ****
** * * **** * * *** * * ** * * * * ** ** **** **


* *** * * *** * * * * = input / 3600;
* **** * ** * **** = (input % 3600) / 60;
* * ** * *** ** * *** * ** = (input % 3600) % 60;


** * ** *** * * * * * * * ** ******* * * ** * * * * * * * ***
***** * * * * * * 0;

}
最新回答 用戶: (-48 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * * ** *
***** ** * ** *



struct Clock{
* * * ***** * * * *** ** hours;
***** * ** * ** ********* minutes;
** * ** * * * **** ** seconds;

};



int main(){
***** ** *** *** ****** * input;
***** ** * * *** *** Clock **
** * * * * * *** * *** * * ** *** * ** *** * ** *


* * ** * * **** ** = input / 3600;
* ** *** *** **** ** = (input % 3600) / 60;
* **** ** * *** * * * = (input % 3600) % 60;


** ** *** ** * * ** ** * * * **** * * ** *** * * ** * ** * ** * **
** ** *** ** * **** * ** ** 0;

}
最新回答 用戶: (38 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * *** * *******
** ** *** * ** ** *



struct Clock{
******* * * *** *** * hours;
* * * ** ** *** ** * minutes;
* * ** * ** * ** * ** ** * seconds;

};



int main(){
* ** * * ** *** ** ** input;
* ** ** ** * * * *** * *** Clock ****
**** ** * * ** * * *** * * * *** ** * *******


* ** **** **** **** **** * = input / 3600;
************ **** ** *** = (input % 3600) / 60;
****** **** ** * * ** * * = (input % 3600) % 60;


** * ***** *** ** *** * *** * * * ** * ** * **** * * * **
* ** *** ** * * **** * ** 0;

}
最新回答 用戶: (6 分)
0 喜歡 0 不喜歡
內容已隱藏
#include ** ****
**** * * *



struct Clock{
* **** * * * * * ** * hours;
*** ** ***** ** ** * * minutes;
*** ***** * * * * * seconds;

};



int main(){
* * * * * **** ** ** input;
* * **** ** *** * * ** * ** * **** Clock ** **
* * * **** ** ** * ** * * *** * * **** * *******


* * * * *** * * *** = input / 3600;
* * * * * * ** * * *** * * * = (input % 3600) / 60;
* ****** ****** * * * * * ** ** ** * = (input % 3600) % 60;


* ** ** ** * ******* * ** * * ** * ** * *** ** ** * * ** * * ****
**** * ** *** * * * ** * **** 0;

}
最新回答 用戶: (-298 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#include ** * *



int main()

{
* *** *** ****** * * * * * * *


*** ** ** ** * *** *** * * * ** *****
** * **** *** **** *** ** * (second>=60)
** ** * * * * ***** * *
* ****** ***** ** *** *** * ** *** * = second/3600;
*** ** ** * * ** * * *** ** ****** **** ***** = second - (3600*hour);
* ** * * *** * * ** * * * ** **** ** * ** * = second/60;
* ** ** ** *** *** ** ***** ** * *** ** * *** **** = second - (60*minute);
* *** * ** ** * *
* ** * ** ** * *** * * * * * ** ** * * **** * *
*** * ** ** * * ***** 0;

}
最新回答 用戶: (-190 分)
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>



struct PPAP

    {
* * ** ** ** * ** *** ** * * * * ** * * *** hour;
* *** * * * * ** ** **** ***** * ** * minute;
* * * **** ** ** * ***** ** *** * * ***** ** * ** *** second;
* ** ***** ** ** *

    



int main()

{
* * * ***** * **** * b;
*** ** * * * **** **** * PPAP a;  
** * **** * * * * **** **** ** * * *
****** * ** *** ** ** *
* * ** ** * * * ** * ****** ** * * * *
* * *** ** ** **
* * * ******** *** * ** * ***
* ******** * * * ** ** * *** * **** ** ********* * ** * **
** * * **** ** *** * *** *** 0;

}
最新回答 用戶: (-264 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * ** ** * * *
*** *** * * *



struct Time {
** * *** * hours;
** * *** * * ** ** minutes;
******** ** **** * * seconds;

};



int main( ) {


* * * * * ***** ** *** ** Time t;
* ** * * ** *** * ** seconds, temp;


* * ** * ** ** ** * * ** * *** *** ** *
* * * * * * * * = *** *
** * ** * ** *** * ** = *** *
* * * ** * * * * * * = temp/60;
* * **** * *** * * * **** = temp%60;
*** * * ** ****** * * **** * *** * ** t.hours, ** ** * **

}
最新回答 用戶: (20 分)
0 喜歡 0 不喜歡
內容已隱藏
#include ** * * ***
* * ** * * ****** **



struct Clock{
** * * * ****** hours;
** *** * * * **** * ** minutes;
** * *** **** * * * ** seconds;

};



int main(){
* ** * * **** * * *** input;
***** * ** *** ** *** ** * Clock ****
* ** *** * * **** * * ** * ** * * * *** ** *******


*** * * ** ** *** * ** * * = input / 3600;
* *** *** * ** ** * * * *** * = (input % 3600) / 60;
*** **** ** ** * * ** = (input % 3600) % 60;


** * * * ** ****** * ******** * * ** * * * * * ** *** ** **
* **** **** * ** * 0;

}
最新回答 用戶: (126 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * ** *** ** *
* * ** ** * ** *



struct Clock{
* ** * *** * * ** hours;
* * ** **** ** * ** * * ** ** minutes;
* * * * ** * * ** seconds;

};



int main(){
**** ** * * *** ** input;
* *** * * **** * * ** *** *** Clock ****
*** * *** **** * ** * *** * * * * * ***


*** ** * * ** ** ** * * ** = input / 3600;
*** ****** ** ** * **** = (input % 3600) / 60;
* * * *** * *** ** ***** * ** = (input % 3600) % 60;


* ** * * * *** ** ** ***** * * * * ** * * * * ** * * *
* * * **** *** * ** * 0;

}
最新回答 用戶: (237 分)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.60
©2016-2025

相關問題

0 喜歡 0 不喜歡
64 回答
[練習] Coding (C) - 最新提問 4月 6, 2017 分類:C |
ID: 23560 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 8.8k 瀏覽
0 喜歡 0 不喜歡
18 回答
[練習] 開放式問答 - 最新提問 4月 20, 2017 分類:C |
ID: 24219 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 3.7k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶