crashing problem in c++
I've been getting a strange problem with a program i'm working on. i'm making a small, dos-based trivia game for a class. the problem i'm having is that, even though the compiler i'm using (bloodshed.net's dev-cpp 4) says there's no errors and compiles fine, whenever i try to run the program it crashes instantly. i've gone through all the files and i've narrowed it down to one. I've been using a 3d array of strings (the class, not char arrays) to store the category names, questions, and answers. i have the array stored in a .hpp file which i include into the main file. this file seems to be causing the problem but i can't figure out how. i've talked to everyone i know that can program and they can't figure it out either. i was hoping that some of you all might be willing to take a look at my code and tell me what the problem is. it's too long to post on here so if you're willing to take a look then please reply here or email me at hideon9 AT yahoo DOT com or im me on yahoo messenger (hideon9). i would really appreciate any help on this, i have to have it done by tomorrow and i'm totally lost. thanks.
Just post the suspected file here as an attachment. Someone will probably help you...
the file i'm having the problem with is attached.
What's the crash error?
You might wanna try initializing all of them as separate declarations instead of using the brackets and ,'s.
i tried it without brackets and commas and when i tried to compile it ended up with 31 new errors.
error that shows when i try to run the game is "This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor."
dunno if this will help but just in case, here are the details:
MAIN caused an invalid page fault in
module MAIN.EXE at 0167:00418904.
EAX=fffffff0 CS=0167 EIP=00418904 EFLGS=00010202
EBX=0041b000 SS=016f ESP=0254f108 EBP=0254f120
ECX=fffffff0 DS=016f ESI=0041b000 FS=3a0f
EDX=0041b000 ES=016f EDI=0000000f GS=0000
Bytes at CS:EIP:
8b 10 89 d0 eb 04 eb 02 eb 00 8b 5d e8 c9 c3 00
0041b000 00000000 00000000 00000000 00000000 00000000 0254f160 00418cd9 0041b000 00000000 00000000 00000000 0041b000 00401a78 0000000f 00000000
A 3d array of stl::strings - are you sure about that??
How are you accessing the variables?
BTW: I noticed that all of your
array[X] cells are unused...deliberate?
is there a problem making an array of strings? i thought you could use the string class by #including <string> and that you could make an array of any type? i'm new to strings so maybe i'm unaware of some problem in this?
accessing the variable just like any other array. like to get the answer to the third question in the first category i would access array. i'm checking the answers against input but everything else just gets printed to the screen.
the array[x] cells are empty because i don't really have anything to put in there the way i have the array set up now. they were used in the way i did have it set up but i had to change it. probably gonna rewrite it eventually but i wanted to find out how it was crashing the program without the compiler finding any bugs.