Write a program that converts a number of seconds to the equivalent number of hours, minutes, and seconds.  It should do the following:  Prompt the user for input Read an integer from the keyboard Calculate the result Use printf to display the output A sample run with input 5000 must look like:   Enter the number of seconds:  5000 5000 seconds = 1 hours, 23 minutes, and 20 seconds 5000 seconds = 01h:23m:20s A sample run with input 3754 must look like:   Enter the number of seconds:  3754 3754 seconds = 1 hours, 2 minutes, and 34 seconds 3754 seconds = 01h:02m:34s Hint1: Use integer division Hint2:  Use the modulus operator Please make sure to end each line of output with a newline.   Please note that your class should be named SecondsConverter.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 13E
icon
Related questions
Question

Write a program that converts a number of seconds to the equivalent number of hours, minutes, and seconds. 

It should do the following: 

  1. Prompt the user for input
  2. Read an integer from the keyboard
  3. Calculate the result
  4. Use printf to display the output



A sample run with input 5000 must look like:

 

Enter the number of seconds:  5000

5000 seconds = 1 hours, 23 minutes, and 20 seconds

5000 seconds = 01h:23m:20s



A sample run with input 3754 must look like:

 

Enter the number of seconds:  3754

3754 seconds = 1 hours, 2 minutes, and 34 seconds

3754 seconds = 01h:02m:34s



Hint1: Use integer division

Hint2:  Use the modulus operator



Please make sure to end each line of output with a newline.

 

Please note that your class should be named SecondsConverter

 

AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr