comp.lang.ada
 help / color / mirror / Atom feed
From: "Rea Burleson (CS)" <burleson@csee.usf.edu>
Subject: try this if you can
Date: 1996/06/05
Date: 1996-06-05T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SUN.3.92.960605203426.13792A-100000@denning> (raw)


For all you ada dudes.  I found this to be a very awarding program to try.
My code was a little of 80 lines,  can you beat it?


The Roman numerals are indicated by the letters I, V, X, L, C, D and M,
corresponding to 1, 5, 10,
50, 100, 500, 1000, respectively. In a Roman number, if the Roman numeral
P stands immediately to
the left of another Roman numeral Q and if P denotes a smaller number than
Q, then the value of P is subtracted from the total number (eg. LIX means
59) otherwise P is added to the total number (eg.
LXI means 61). For simplicity, it can be assumed that when a Roman number
is input at least one space is left between the numerals. For instance the
user can input M X M I V at the terminal. The
program should then print out 1994.

Write a program that first asks a user if s/he wishes to convert from an
integer to a Roman number, or vice versa. The program should then ask the
user for the input (either an integer or a Roman
number) and produce the corresponding counterpart as output (a Roman
number or an integer).Your program should be able to do some error checking - i.e. if the user
enters an illegal Roman numeral, this should be indicated to the user.
There should be no differentiation between lower and upper case.

The program should ask the user if s/he wishes to continue conversions and
should proceed to do so
until indicated otherwise.







             reply	other threads:[~1996-06-05  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-05  0:00 Rea Burleson (CS) [this message]
1996-06-05  0:00 ` try this if you can David Weller
1996-06-06  0:00   ` David Kristola
1996-06-07  0:00     ` GUI builder for Macs Arthur Evans Jr
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox