By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,017 Members | 1,169 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,017 IT Pros & Developers. It's quick & easy.

Input time in seconds-output in hours, minutes, seconds

P: 1
I would like to ask for some help with this assignment as i don't know how to start it.

Write a C++ program that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (for example, if the elapsed time is 9630 seconds, then the output is 2:40:30.)

Can anyone pls help me!!
Im using visual studio
Thanks to those who help me and have the patience to read.
Feb 6 '07 #1
Share this Question
Share on Google+
1 Reply


Ganon11
Expert 2.5K+
P: 3,652
Think about the math involved. How will you convert seconds into minutes? Minutes into hours? How will you know how to get the leftovers?

Once you answer these questions you will be able to easily convert these steps into C++.

Note: You will likely use the division operator / and the modulus division operator % frequently.
Feb 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.