I can't do a goto loop. man, i really suck.
I can't do a goto loop. man, i really suck.
This war, like the next war, is a war to end war.
err.. a what loop?
so does goto loopsI can't do a goto loop. man, i really suck
what do yo need it for anyway?
you're most definetly better off with for or while or something
similar,
if you REALLY want goto loops post some code and I'll help
/btq
...viewlexx - julie lexx
my book says do this:
Code:#include <iostream> using namespace std; char n; char pass; char done; char start; int main() { start; cout << "enter password: "; cin >> pass; if(pass = 'secret') cout << "access granted, activating system 2342"; clrscr(); cout << "/nsystem error. Try again? "; cin >> n; if((n != 'y') goto done; else goto start; done; return 0; }
This war, like the next war, is a war to end war.
well, try exchanging the semicolon after the labels to a colon..
that is instead of
start;
type
start:
haven't used em in ages though
/btq
...viewlexx - julie lexx
I think it should be
start:
not start;
But I wouldn't know, since I've never used goto before. Why? because it SUCKS.
i get this error:
line 2084: parse error before string constant.
Looking at the code, does it look like a 2048 line code?
This war, like the next war, is a war to end war.
Im thinking the way to solve it is to use the book as fire starter....
it was only $64.00
This war, like the next war, is a war to end war.
what book is still promoting goto?
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
teach youself c++ 6th Edition by al stevens
This war, like the next war, is a war to end war.
Avoid goto's until you *really* need them. Learn for and while for now.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Well, if this is code from a book.. wow.Originally posted by Blizzarddog
start; //wrong label format
....
if(pass = 'secret') //
....
clrscr(); //no, no , no
.....
if((n != 'y') goto done; //notice the parenthesis
....
done; //hehe
That is a very good idea.Originally posted by Blizzarddog
Im thinking the way to solve it is to use the book as fire starter....
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
i can do while. for... hmmm. ill have to learn those.
This war, like the next war, is a war to end war.
Yepo, its ashes.
This war, like the next war, is a war to end war.
Unfortunatly, it's not rare to find a book on the subject of programming with many inaccuracies to it... this book is definatly one of them!