Anybody fix this simple code?

This is a discussion on Anybody fix this simple code? within the C++ Programming forums, part of the General Programming Boards category; Hey all, I'm using Visual C++. This code is updated, no errors but it always reads choice 1 except on ...

I can't see a place where you declare the two variables mentioned in the error messages. Even if you're using cin or something like that to get values into the variables, you still need to declare them (i.e. int ynbeer) to allocate space in memory for the data. Hope this helps!

No. Label is the term the compiler using to refer to any name you've given something. It doesn't know if it's supposed to be a variable or what, but if it's not in it's little "dictionary", then undefined label is the term it'll use. Post your code. It sounds to me like you just forgot a couple of semicolons and that's making the problem spillo ver into other veriables. (You just need to post the part of your code where you're declaring all your variables I think).

In most cases, if the compiler comes across a word it doesn't recognize, it'll give you an error. It'll recognize words that are reserved (words like int, static, etc...) and the names of functions and variables that you have already declared and / or defined. So in in a sense it does keep a dictionary of those reserved words and all the variables / functions you've declared (i.e. all 'labels'). There are way to make the compiler ignore the fact that it doesn't recognize the word (like using the extern keyword), but in the code posted above, the compiler had no way of knowing how to handle the variable he was referring to, and that's why it threw the error.

Not exactly. I'm patient with polite newbies like you. Take a look at my signature and you'll see that I can get very cynical very quickly. And I wouldn't call myself a C++ guru. There's a lot of people at this board that are a lot better at it than me. I've tried to have a pretty general knowledge of most of the common languages, but there are people here the live and breathe C++ - and they know every detail about the specifications. Once you've done C++ for a little while, thought, you're able to spot problems in code very easily.

Alright alright, I know what he said I did take out the goto statements but did everything he said and it didn't work, so I just put the original code back in. Now I took out the goto statements
and changed the gotravel to traveln (that took out the complaint about that) but it still gives me the other 3 and calls them undeclared identifiers instead of labels.