0 thích 0 k thích
5.7k đã xem

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

 

 

 

[Exercise] Coding (C) - đã hỏi trong C
ID: 23557 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 5.7k đã xem
0 0
Called for Help

32 Trả lời

0 thích 0 k thích
Hidden content!
#include * * * * ** **
* ** *** ** ** ** *



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

};



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


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


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

}
trả lời bởi (-218 điểm)
0 thích 0 k thích
Hidden content!
#include * *** * * *
* ** ******* ****



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

};



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


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


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

}
trả lời bởi (-48 điểm)
0 thích 0 k thích
Hidden content!
#include *** ******
** *** ** * ****



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

};



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


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


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

}
trả lời bởi (38 điểm)
0 thích 0 k thích
Hidden content!
#include ** * *
* * * * *** * *



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

};



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


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


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

}
trả lời bởi (6 điểm)
0 thích 0 k thích
Hidden content!
#include *** * * * ** *
* * ** * * *** * *



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

};



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


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


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

}
trả lời bởi (-298 điểm)
0 thích 0 k thích
Hidden content!
#include <stdio.h>

#include ** *** * *** ***



int main()

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


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

}
trả lời bởi (-190 điểm)
0 thích 0 k thích
Hidden content!
#include<stdio.h>



struct PPAP

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

    



int main()

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

}
trả lời bởi (-264 điểm)
0 thích 0 k thích
Hidden content!
#include * *** *
*** ** ** * *



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

};



int main( ) {


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


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

}
trả lời bởi (20 điểm)
0 thích 0 k thích
Hidden content!
#include ***** * *******
* * * * * **** ** *



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

};



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


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


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

}
trả lời bởi (126 điểm)
0 thích 0 k thích
Hidden content!
#include * **** * ***
** * **** *****



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

};



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


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


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

}
trả lời bởi (237 điểm)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.159.115.10
©2016-2026

Những câu hỏi liên quan

0 thích 0 k thích
64 trả lời
[Exercise] Coding (C) - đã hỏi ngày 6 tháng 4 năm 2017 trong C
ID: 23560 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 9.9k đã xem
0 thích 0 k thích
18 trả lời
[Exercise] Essay (Open question) - đã hỏi ngày 20 tháng 4 năm 2017 trong C
ID: 24219 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 4.3k đã xem
12,783 câu hỏi
183,442 trả lời
172,219 bình luận
4,824 thành viên