| adsquared (1) | |||||||||
|
Hello, I have an error that I am having a hard time comprehending because there isn't a lot of explanation, and I have tried searching for hours for similar problems but it doesn't seem like a lot of people have gotten this error. I am creating a Roman Numeral class (homework, but i have all of the coding done) and it is giving me a reading location error. roman.h:
roman.cpp (implementation file)
Driver: romanDrive.cpp
Then I get this error (included a picture so that you can see my Visual C++ set up, and the error screen) http://tinypic.com/r/f1lx4/6 for those that can't click the pic: this is the error I get: Unhandled exception at 0x00ae2ff6 in Roman.exe: 0xC0000005: Access violation reading location 0x00350250. and it pulls up the xstring include file and points to this line of code:
specifically the return line. Please help! | |||||||||
|
|
|||||||||
| Disch (8338) | |||||
You're stepping out of bounds of your lookup tables. Take a closer look at your roman constructor:
Note my comments. Your calculations there are wrong. Remember that % gives you the remainder after division. So let's plug in an example number. Let's say that decNum = 1539:
See the problem? | |||||
|
|
|||||