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

Given input time, print out time in text (2:00 = Two o'clock)

P: 3
Write a program that allows a user to input two numbers (the first between
1 and 12, the second between 0 and 59 inclusive) and then prints out the
time they represent, in words. You should follow the format of the example:
Hours: 4
Minutes: 12
Twelve minutes past four
If the number of minutes is greater than 30, you should say the time is “to”
the next hour, otherwise the time should be “past” the current hour.

how to do this?
Aug 6 '07 #1
Share this Question
Share on Google+
2 Replies


P: 36
Write a program that allows a user to input two numbers (the first between
1 and 12, the second between 0 and 59 inclusive) and then prints out the
time they represent, in words. You should follow the format of the example:
Hours: 4
Minutes: 12
Twelve minutes past four
If the number of minutes is greater than 30, you should say the time is “to”
the next hour, otherwise the time should be “past” the current hour.

how to do this?
First thing you should probably do is figure out the overall steps you would need to accomplish what they are asking. For example, get first number from user, check to see if it's valid, get second number... and so on. Don't worry about code until you get what you need to do figured out.
Aug 6 '07 #2

RedSon
Expert 5K+
P: 5,000
:: SubScribing ::
Aug 6 '07 #3

Post your reply

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