# A very simple programming question

OK, real quick, story of my life. I started programming on calculators and I got pretty good at it. I could make all sorts of games, but its a lot (and i mean a lot) less complicated then c++. NOW WITH THE QUESTION. On a calculater you do GOTO 1, and then you make a LBL 1. The question is how to I do something like that with c++?!?!?!?
example on calculator:

If N+M=6
then
goto 1
else
goto 2
Lbl 1
Disp "blah blah blah"
Lbl 2
Disp "BLAH BLAH BLAH"

Now that is just an example on a calculator so please dont correct me if thats incorrect.
HOW WOULD I DO SOMETHING LIKE THAT ON C++

thnx.

• : OK, real quick, story of my life. I started programming on calculators and I got pretty good at it. I could make all sorts of games, but its a lot (and i mean a lot) less complicated then c++. NOW WITH THE QUESTION. On a calculater you do GOTO 1, and then you make a LBL 1. The question is how to I do something like that with c++?!?!?!?
: example on calculator:
:
: If N+M=6
: then
: goto 1
: else
: goto 2
: Lbl 1
: Disp "blah blah blah"
: Lbl 2
: Disp "BLAH BLAH BLAH"
:
: Now that is just an example on a calculator so please dont correct me if thats incorrect.
: HOW WOULD I DO SOMETHING LIKE THAT ON C++
:
: thnx.
:

First of all, forget what you learned when you learned BASIC! In C and C++ the [b]goto[/b] statement is rarely, if ever, used. Anyone who works for me would be fired if he/she used that in a program!

There are a lot better ways of coding that
[code]
if( (N+M) == 6)
printf("Sum is 6
");
else
printf("Sum is not 6
");
[/code]
• : : OK, real quick, story of my life. I started programming on calculators and I got pretty good at it. I could make all sorts of games, but its a lot (and i mean a lot) less complicated then c++. NOW WITH THE QUESTION. On a calculater you do GOTO 1, and then you make a LBL 1. The question is how to I do something like that with c++?!?!?!?
: : example on calculator:
: :
: : If N+M=6
: : then
: : goto 1
: : else
: : goto 2
: : Lbl 1
: : Disp "blah blah blah"
: : Lbl 2
: : Disp "BLAH BLAH BLAH"
: :
: : Now that is just an example on a calculator so please dont correct me if thats incorrect.
: : HOW WOULD I DO SOMETHING LIKE THAT ON C++
: :
: : thnx.
: :
:
: First of all, forget what you learned when you learned BASIC! In C and C++ the [b]goto[/b] statement is rarely, if ever, used. Anyone who works for me would be fired if he/she used that in a program!
:
: There are a lot better ways of coding that
: [code]
: if( (N+M) == 6)
: printf("Sum is 6
");
: else
: printf("Sum is not 6
");
: [/code]
:
thank you so much, it helped TONS
• : : : OK, real quick, story of my life. I started programming on calculators and I got pretty good at it. I could make all sorts of games, but its a lot (and i mean a lot) less complicated then c++. NOW WITH THE QUESTION. On a calculater you do GOTO 1, and then you make a LBL 1. The question is how to I do something like that with c++?!?!?!?
: : : example on calculator:
: : :
: : : If N+M=6
: : : then
: : : goto 1
: : : else
: : : goto 2
: : : Lbl 1
: : : Disp "blah blah blah"
: : : Lbl 2
: : : Disp "BLAH BLAH BLAH"
: : :
: : : Now that is just an example on a calculator so please dont correct me if thats incorrect.
: : : HOW WOULD I DO SOMETHING LIKE THAT ON C++
: : :
: : : thnx.
: : :
: :
: : First of all, forget what you learned when you learned BASIC! In C and C++ the [b]goto[/b] statement is rarely, if ever, used. Anyone who works for me would be fired if he/she used that in a program!
: :
: : There are a lot better ways of coding that
: : [code]
: : if( (N+M) == 6)
: : printf("Sum is 6
");
: : else
: : printf("Sum is not 6
");
: : [/code]
: :
: thank you so much, it helped TONS
:
one more question, if you have 2 if( statements for example;

if( (x+y) == 25)
cout << "Hello"
cout << "what is 2+2?"
int t;
cin << t;
if( (t) == 4)
cout << "blah"
else;
cout << "BLAH"

how would you make an "else;" statement for the first "if(", basically im asking wherer would you put it?

• : one more question, if you have 2 if( statements for example;
:
[code]
: if( (x+y) == 25)
[red]{[/red]
: cout << "Hello"
: cout << "what is 2+2?"
: int t;
: cin << t;
[red]}
else if( (t) == 4)
{[/red]
: cout << "blah"
[red]}[/red]
: else
: cout << "BLAH"
[/code]
:
: how would you make an "else;" statement for the first "if(", basically im asking wherer would you put it?
:
:

[blue]you really need to read an into to C book or tutorial.[/blue]
• : : one more question, if you have 2 if( statements for example;
: :
: [code]
: : if( (x+y) == 25)
: [red]{[/red]
: : cout << "Hello"
: : cout << "what is 2+2?"
: : int t;
: : cin << t;
: [red]}
: else if( (t) == 4)
: {[/red]
: : cout << "blah"
: [red]}[/red]
: : else
: : cout << "BLAH"
: [/code]
: :
: : how would you make an "else;" statement for the first "if(", basically im asking wherer would you put it?
: :
: :
:
: [blue]you really need to read an into to C book or tutorial.[/blue]
:
yea, im gettin windows game programming for dummies, lol :-)

• : :
: yea, im gettin windows game programming for dummies, lol :-)
:

If you have not yet bought it -- don't. You need to learn the language before you can write any games. Get an Introduction to C/C++, or one of the Teach Yourself books.
• hey man, u can do it in c++ simply...here is an example:

if(x>10)
goto label1;//you can use any identifier here instead of "label1"
.
.
.

label1: //after the identifier name u must type ":"

//rest of program
.
.
.

• nah stober,
thanks for the advice stober, but i already bought it, (xmas). But im gettin really good with programming. I can make great logon screens and simple text games with like over 200 lines. I think having the book will be good for future reference.