Hey there,
I decided to start teaching myself C++ this weekend - before I get started with my post, I should apologize in advance for the n00b question - take it easy on me
I would also like to preface my question with a description of the program I am writing (as I am not currently home, and can't supply my source code for you to view):
For my first project, I decided to go a bit beyond the cliche "Hello, World" program.
I made a multiple choice quiz - to help my girlfriend study for a state-regulated exam she has coming up.
Right now, it consists of 25 questions - all with multiple choice a, b, c or d answers.
If you get the answer correct, you are told so, and get to move on to the next question.
If you get the answer incorrect, you are told the correct answer, and get to move on to the next question.
At the end of the quiz a score is given.
I would like to expand on this program - offering multiple "sections" of study.
Ideally, you would be greeted by a "table of contents", from which you could select which section you would like to study from. Once you make a selection, it would jump you to that part of the quiz.
I did some research online, and saw that some people use the "GOTO" command to jump to specific sections of their code.... With that said, I saw a good amount of articles that mentioned using the "GOTO" command as being a bad practice for good c++ programming.
So - what alternatives do I have to the "GOTO" command?
I really like how easy it is to just place a marker/label in your code, and jump straight to it - I don't really understand why this would be a bad thing to do.
Any insight here would be greatly appreciated!
I decided to start teaching myself C++ this weekend - before I get started with my post, I should apologize in advance for the n00b question - take it easy on me
I would also like to preface my question with a description of the program I am writing (as I am not currently home, and can't supply my source code for you to view):
For my first project, I decided to go a bit beyond the cliche "Hello, World" program.
I made a multiple choice quiz - to help my girlfriend study for a state-regulated exam she has coming up.
Right now, it consists of 25 questions - all with multiple choice a, b, c or d answers.
If you get the answer correct, you are told so, and get to move on to the next question.
If you get the answer incorrect, you are told the correct answer, and get to move on to the next question.
At the end of the quiz a score is given.
I would like to expand on this program - offering multiple "sections" of study.
Ideally, you would be greeted by a "table of contents", from which you could select which section you would like to study from. Once you make a selection, it would jump you to that part of the quiz.
I did some research online, and saw that some people use the "GOTO" command to jump to specific sections of their code.... With that said, I saw a good amount of articles that mentioned using the "GOTO" command as being a bad practice for good c++ programming.
So - what alternatives do I have to the "GOTO" command?
I really like how easy it is to just place a marker/label in your code, and jump straight to it - I don't really understand why this would be a bad thing to do.
Any insight here would be greatly appreciated!