comp.lang.ada
 help / color / mirror / Atom feed
* try this if you can
@ 1996-06-05  0:00 Rea Burleson (CS)
  1996-06-05  0:00 ` David Weller
  0 siblings, 1 reply; 4+ messages in thread
From: Rea Burleson (CS) @ 1996-06-05  0:00 UTC (permalink / 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.







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: try this if you can
  1996-06-05  0:00 try this if you can Rea Burleson (CS)
@ 1996-06-05  0:00 ` David Weller
  1996-06-06  0:00   ` David Kristola
  0 siblings, 1 reply; 4+ messages in thread
From: David Weller @ 1996-06-05  0:00 UTC (permalink / raw)



In article <Pine.SUN.3.92.960605203426.13792A-100000@denning>,
Rea Burleson (CS) <burleson@csee.usf.edu> wrote:
>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?
>
>

Unlike the culture of single-letter programming languages, most "Ada
dudes" won't engage in "write this in less than X lines" game.
Generally because:
	1) We're not very keen on doing homework assignments for
	students :-)
	2) We know that the length has nothing to do with the quality
	3) We know that length has little correlation to efficiency

Otherwise, I'd say we're all for that challenge:

with Text_io; use Text_io; -- trying to improve obscurity
procedure RN is  -- long names take up executable space
begin
put_line("please enter: MXMIV");  -- same for indentation
put_line("1994"); -- we know the answer, why bother waiting for input?
		  -- it's much faster this way. 
end;


Ah, wefweshing! :-)  No wonder I graduated with high honors :-)
-- 
    Visit the Ada 95 Booch Components Homepage: www.ocsystems.com/booch
           This is not your father's Ada -- lglwww.epfl.ch/Ada




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: try this if you can
  1996-06-05  0:00 ` David Weller
@ 1996-06-06  0:00   ` David Kristola
  1996-06-07  0:00     ` GUI builder for Macs Arthur Evans Jr
  0 siblings, 1 reply; 4+ messages in thread
From: David Kristola @ 1996-06-06  0:00 UTC (permalink / raw)



Two questions:
1) when counting lines, how do you count reuse code?
2) in general, how do i count lines (the RM specifies a minimum line size that
must be supported by compilers (i believe 200 characters), so i could use really
long source lines, skip the comments, and concatenate everything on to a single
long line)?

Besides, i would much rather solve some of the problems i have here at work, or
at home (a GUI builder for Macs, that produces Ada code, for instance).

with Text_io; use Text_io; procedure RN is begin put_line("please enter: MXMIV"); put_line("1994"); end RN;

---

david kristola
Work: davidk@os1.ese.lmsc.lockheed.com
Play: DJKristola@aol.com





^ permalink raw reply	[flat|nested] 4+ messages in thread

* GUI builder for Macs
  1996-06-06  0:00   ` David Kristola
@ 1996-06-07  0:00     ` Arthur Evans Jr
  0 siblings, 0 replies; 4+ messages in thread
From: Arthur Evans Jr @ 1996-06-07  0:00 UTC (permalink / raw)



David Kristola <davidk@os1.ese.lmsc.lockheed.com> wrote some stuff
about Roman numeral conversion.  Then there was the good part:

> Besides, i would much rather solve some of the problems i have here at
> work, or at home (a GUI builder for Macs, that produces Ada code, for
> instance).

Say more!  What is it?  When will it be available?

Art Evans

Arthur Evans Jr, PhD        Phone: 412-963-0839
Ada Consulting              FAX:   412-963-0927
461 Fairview Road
Pittsburgh PA  15238-1933
evans@evans.pgh.pa.us




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-06-07  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-05  0:00 try this if you can Rea Burleson (CS)
1996-06-05  0:00 ` David Weller
1996-06-06  0:00   ` David Kristola
1996-06-07  0:00     ` GUI builder for Macs Arthur Evans Jr

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