I am reletivly new to c++ , but i know quite a lot. I am working on a text based adventure to test my skills..... yeah...... and I am unsure of how to go from one place to another by skipping the code like :
I want to know this so I can go from an if statement and a else if statement to the corresponding place. say for example I have a choice of 2 paths to take and the user would input l or r, i know how to do the if statements but i would like to be able to skip the code so it is more organised and so i can go back from one place to another that i have already been.
Before long you'll probably receive a reply stating that the console is terrible for making games, but before that happens, let me ask you if you're going to be using an object oriented, or procedural approach for this?
I had a long post typed up but my session got reset and I lost it :(
At this point using the console for a game would likely teach you some bad practices (and would be impossible to port to a non-console version). Read up on classes and inheritance, and get familiar with the other aspects of object oriented design. After you get that under your belt you should be ready to make a game (without fear of being stoned for abusing the console).
What makes you think there is something wrong with the console? It's an output device like any other. Not really the best there is for games, but it works.
If you're curious, you can check out the article about it. (I didn't write it, nor do I particularly agree with all of the contents therein, but the concept is sound imo.)
http://cplusplus.com/forum/articles/28558/
The reason that I'm pushing an object oriented approach here is so that the game logic and what the player sees are more easily interchangeable, so it wouldn't completely shut the door on a graphical solution later on down the road.
*Edit2 - Also, the OP mentions jumping around in the code which could lead to a non-structured nightmare - but I have to admit, the goto keyword seemed like a good idea when I first started learning C++ so I really can't blame one for the temptation.
You can certainly start with the console then move up to a graphical environment. Just separate your game logic from your visual logic. However you don't even really need a graphical program if it's just a text adventure. So the point is really moot.
On your question. I would say do something like have room objects that have certain properties. And as for the going back to it, then you would simply have to swap back to a certain object (or event) and you can even pass in additional parameters so you can augment the decisions based on your previous actions.