Posts: 4
Threads: 1
Joined: Sep 2003
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.
Posts: 3,368
Threads: 195
Joined: Jan 2003
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.
Posts: 3,343
Threads: 83
Joined: Mar 2003
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:
Posts: 4
Threads: 1
Joined: Sep 2003
you got it
Posts: 1,272
Threads: 36
Joined: Feb 2003
Woah, you didn't do all of it by hand, did you?
Posts: 3,368
Threads: 195
Joined: Jan 2003
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.
Posts: 3,288
Threads: 167
Joined: Nov 2001
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!!!
Posts: 3,343
Threads: 83
Joined: Mar 2003
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 ;*)
Posts: 4
Threads: 1
Joined: Sep 2003
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.
Posts: 3,343
Threads: 83
Joined: Mar 2003
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.