Skip to main content
GameDev.net gamedev.net
🔒 Locked

C++, can it Skip Code?

Started by orcfan32 Sep 18, 2005 at 5:38 PM 4 replies 1.2k views
Original Post
orcfan32
orcfan32
I have been programming a little project of mine that whenever I do my function that I call, the program seems to do it and then exit before I can even see the results. I even have system("PAUSE"); and cin.get(); at the end of main, but it still skips. Has this happened to anyone else and how can I fix it?
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit
SiCrane
SiCrane
Your program could be crashing or throwing an exception before reaching the end. If you run it in a debugger try putting a breakpoint on the last brace in main().
Zahlman
Zahlman
Your last bit of output might also not be flushed before your pause at the end. :/
orcfan32
orcfan32
Well, I don't know whats going on. I guess the debugger in Dev-C++ pretty much sucks. I hope I can get this working soon..
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit
iMalc
iMalc
Please give more details, and remember to post replies to suggestions you have been given, or it is unlikely you will get furthur suggestions. People need to know whether or not you actually tried the suggestions, or didn't understand them, or need furthur explanation first.
orcfan32
orcfan32
I just ended up fixing it. My loop never ended because an if statement was never met because the substr method is screwy. I had assigned a string to substr 0,0 when it should have been 0,1.
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.