Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting numbers into roman numerals..
#1
I was wondering if anyone had an easy way I could go at this...

I need to go up to 2003, and I could do it in 2027 lines of code [bunch of if statements, lol] but I know you could do it with a DO loop.

If anyone has any ideas for me, please reply.
Reply
#2
http://www.geocities.com/pisforpi/flyingsoft

"Roman Numerals". Downloads section. Has source code.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#3
Quote:I need to go up to 2003, and I could do it in 2027 lines of code [bunch of if statements, lol] but I know you could do it with a DO loop.

Sounds suspiciously like:

Code:
IF num$ = 1 THEN PRINT "I"
IF num$ = 2 THEN PRINT "II"
...
IF num$ = 2003 THEN PRINT "MMIII"

:rotfl:
Reply
#4
you got it Tongue
Reply
#5
Woah, you didn't do all of it by hand, did you?
Reply
#6
My program is 100% bug free....
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#7
Quote:
dave Wrote:I need to go up to 2003, and I could do it in 2027 lines of code [bunch of if statements, lol] but I know you could do it with a DO loop.

Sounds suspiciously like:

Code:
IF num$ = 1 THEN PRINT "I"
IF num$ = 2 THEN PRINT "II"
...
IF num$ = 2003 THEN PRINT "MMIII"

:rotfl:

Dang!!! I just remembered that I posted something like that for an odd even number problem.

Welcome to the club!!!
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#8
I remember that!

Code:
IF num = 1 THEN PRINT "Odd."
IF num = 2 THEN PRINT "Even."
IF num = 3 THEN PRINT "Odd."
...
IF num = 600000 THEN PRINT "Even."

:rotfl:

I seem to recall that the person asking for it had trouble compiling it ;*)
Reply
#9
First off I was just gonna do it in an array with all the set roman numerals like M, D, L, V etc...and whenever it wasnt one of those then do the math to get the number..

I had like

DIM ones$(9)
LET ones$(1) = "I"
LET ones$(2) = "II"
LET ones$(3) = "III"
....

DIM hundreds$(900)
....
LET hundreds$(500) = "M"
....


you get the point.
Reply
#10
Nightmare... :lol:

Is agamemnus's program good for you?

ps: LET is ancient. You can completely omit the word LET in front of a variable, and QB will understand.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)