473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
2 1486
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
5,000 Expert 4TB
:: SubScribing ::
Aug 6 '07 #3

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

Similar topics

10
by: Andreas | last post by:
Hi! Is it possible to get a time event at a specific time, for instance eight a'clock? My program is running in the background and is minimized to the tray bar. If not, is there a smooth way...
5
by: Art | last post by:
Hi, I'm using a form text input to display a JavaScript clock. It has no other purpose than that, just show the date and time. What I would like to do now is prevent anything else happening when...
6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
17
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. ...
5
by: yinglcs | last post by:
Hi, I am following this python example trying to time how long does an operation takes, like this: My question is why the content of the file (dataFile) is just '0.0'? I have tried "print...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
1
by: morangi | last post by:
<?php session_start(); error_reporting(E_ERROR && ~E_NOTICE && ~E_WARNING); ob_start(); $link = mysql_connect('localhost', 'root', 'test'); if (!$link) { die('Could not connect: ' ....
9
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the...
28
by: n00m | last post by:
Both codes below read the same huge(~35MB) text file. In the file 1000000 lines, the length of each line < 99 chars. Stable result: Python runs ~0.65s C : ~0.70s Any thoughts?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.