Jun 10, 2015 at 3:02pm
This is a line of the coding of my program.
Please consider the error in the title.
The error come in last line.
default:
cout<<"OOPS!!! Your choice is wrong";
getch();
goto again();
This error is present in the goto line.
I don'y know why this error is coming because its correct.
Please help!!!!!!!!!!!!!!!!!!!
Jun 10, 2015 at 3:11pm
goto again(); ?, this is not correct at all.
http://en.cppreference.com/w/cpp/language/goto
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#include <iostream>
int main(int argc, const char * argv[])
{
if (argc == 1) {
goto LABEL2;
} else {
goto LABEL1;
}
LABEL1:
std::cout << "hello label1" << std::endl;
goto EXIT;
LABEL2:
std::cout << "hello label2" << std::endl;
goto EXIT;
std::cout << "hello never" << std::endl;
EXIT:
return 0;
}
|
like in ASM you switch blocks.
Last edited on Jun 10, 2015 at 3:40pm
Jun 10, 2015 at 3:18pm
Better yet forget you've even heard about the goto statement and use one of the other more acceptable looping constructs and functions.
Jun 14, 2015 at 5:33pm
oh, i got it thank u!!!!!!