![]() |
|
#1
|
|||
|
|||
Roman into Decimal ProgramHello everyone!
I wrote this program which is meant to convert Roman numerals into decimal. I checked a few Roman numerals on it, it does convert CCCLIX to 359 alright but not MCXIV to 1114 (instead the output is 1113) or MDCLXVI to 1666 (the output being 1663). I know there is some logic problem but I can't figure out what. Could anyone please have a look at it? CPP / C++ / C Code:
|
|
#2
|
|||
|
|||
Re: Roman into Decimal ProgramHi,
You have some programming errors:
Regards __________________
Please, correct me if I'm wrong, and sorry for my english ;) |
|
#3
|
|||
|
|||
Re: Roman into Decimal ProgramThanks mamntc!
I have corrected the syntactic errors now, and edited the code to this for X CPP / C++ / C Code:
and this for V CPP / C++ / C Code:
It gives the numbers correctly, at least the ones I checked. Is it okay now? How do I correct the out-of-bounds error? |
|
#4
|
|||
|
|||
Re: Roman into Decimal ProgramQuote:
CPP / C++ / C Code:
CPP / C++ / C Code:
Regards. __________________
Please, correct me if I'm wrong, and sorry for my english ;) |
|
#5
|
|||
|
|||
Re: Roman into Decimal ProgramThanks once again!
We haven't done operator overloading so I am gonna skip that at the moment. As for the other code, I am going to try implementing that, though I was wondering if it does calculate okay without (if>0) condition, whats the point of it? The code for number[-1] won't implement in either case (correct me if I am wrong, my concepts aren't too good) |
|
#6
|
|||
|
|||
Re: Roman into Decimal Programi have the same problem in my class i am wondering if u have the full solution to the roman--> decimal program, although i get the coding part for the function i am not good at class coding so here is the shortest way to have a conversion function i am assuming that u used a select case for the M=1000,V=5.....
CPP / C++ / C Code:
Last edited by admin II : 04-May-2008 at 17:19.
Reason: Please surround your C++ code with [cpp] your code [/cpp]
|
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 10:13 |
| How to read particular memory location ? | realnapster | C Programming Language | 10 | 10-May-2006 09:11 |
| help writing a roman numeral to decimal program | Ichigo | C++ Forum | 3 | 23-Mar-2006 14:05 |
| Frustration...Roman Numeral Program | SpyD3r | C++ Forum | 14 | 13-Nov-2005 20:02 |
| Roman to decimal to roman | SpudNuts | C++ Forum | 2 | 16-Feb-2005 19:44 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The