Problem with script (no errors but no output?)

Started by
3 comments, last by Smacker_626 12 years, 1 month ago
Hey

I been learning C++ for about 2 days now and for the most part it was going fine i made a blackjack game and some puzzle game. So i then tried a basic 2D role playing type thing.

Course now for some reason, it all goes wrongs tongue.png I get no output on my screen but i equally got no errors displayed when i ran the script. I was hoping some one could run my script and see if it outputs for you ...

My script is here:

http://www.paste.to/MzQ0MzMz[/quote]

I'm currently using C++ console. So its very basic stuff.

I'm hoping some one can spot the mistake I'm sure its something obvious but my eyes must have been staring at it for so long i simply cannot see where the issue lies.

Thanks for you're time in advance.
Advertisement

  1. At the beginning of the file, include "cstdlib" so that you can access rand() and srand().
  2. You have a name conflict in class cDungeon. At line 52 in the constructor you define a variable named aaMaze even though at line 73 you define a data member with the same name. This wouldn't normally be a problem but in this case you try to use both in the constructor and so you're really only using the one you defined at line 52. Fix the name conflict.

Do these 2 things and your code works fine.

Hope that helps smile.png.

I get no output on my screen but i equally got no errors displayed when i ran the script.


Your compiler will be generating error messages. If you're using a development environment such as Visual Studio, XCode, Code::Blocks, KDevelop, etc, there will be a window that you can show which will display the build errors (or a triaged interpretation of them).

  1. At the beginning of the file, include "cstdlib" so that you can access rand() and srand().
  2. You have a name conflict in cDungeon. The constructor uses a local variable named aaMaze but there's a data member called aaMaze as well. Fix the name conflict.

Do these 2 things and your code works fine.

Hope that helps smile.png.


You've lost me on number 2... can't see where you're referring to =/

EDIT: Ah i see - it works now :)

[quote name='Smacker_626' timestamp='1330759191' post='4918800']

  1. At the beginning of the file, include "cstdlib" so that you can access rand() and srand().
  2. You have a name conflict in cDungeon. The constructor uses a local variable named aaMaze but there's a data member called aaMaze as well. Fix the name conflict.

Do these 2 things and your code works fine.

Hope that helps smile.png.


You've lost me on number 2... can't see where you're referring to =/

EDIT: Ah i see - it works now smile.png
[/quote]
Sorry I wasn't very clear, I've edited my post to be a bit clearer.

Glad to help.

This topic is closed to new replies.

Advertisement