0 like 0 dislike

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) - asked in C
Available when: Unlimited - Due to: Unlimited
| 218 views
0 0
Called for Help

32 Answers

0 like 0 dislike
Hidden content!
#include * * * ***** *
*** *** * *** * * *



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

};



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


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


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

}
answered by (-218 points)
0 like 0 dislike
Hidden content!
#include ** ***
*** *** * ** *



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

};



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


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


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

}
answered by (-48 points)
0 like 0 dislike
Hidden content!
#include * * ****
*** * * *** * * *



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

};



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


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


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

}
answered by (38 points)
0 like 0 dislike
Hidden content!
#include ***** ** ***
** ** * ** * * *



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

};



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


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


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

}
answered by (6 points)
0 like 0 dislike
Hidden content!
#include ** * ** * ** *
** * * * ** ***



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

};



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


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


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

}
answered by (-298 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

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



int main()

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


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

}
answered by (-190 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>



struct PPAP

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

    



int main()

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

}
answered by (-264 points)
0 like 0 dislike
Hidden content!
#include * **** * * ***
*** * * * * **



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

};



int main( ) {


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


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

}
answered by (20 points)
0 like 0 dislike
Hidden content!
#include * * ** ***
* * * * * *** *



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

};



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


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


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

}
answered by (126 points)
0 like 0 dislike
Hidden content!
#include * * * *** ** **
** ** ** *** ** * ** *



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

};



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


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


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

}
answered by (237 points)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:173.245.54.115
©2016-2021

Related questions

0 like 0 dislike
64 answers
[Exercise] Coding (C) - asked Apr 6, 2017 in C
Available when: Unlimited - Due to: Unlimited
| 389 views
0 like 0 dislike
18 answers
[Exercise] Essay (Open question) - asked Apr 20, 2017 in C
Available when: Unlimited - Due to: Unlimited
| 293 views
11,163 questions
132,617 answers
129,948 comments
3,821 users