+ 2
How to use goto statement ?
19 Answers
+ 5
I can give an example :
#include <iostream>
#include <cstdlib>
void main()
{
int year;
P: cout<<"\n Enter any year";
cin>>year;
if(year%4==0)
{
cout<<"\n Its a leap year";
}
else
{
cout<<"\n Its not a leap year";
}
cout<<"\n Do you want to continue(Y/N)";
ch cn;
if(cn=='Y'||cn=='y')
goto P;
else
exit(0);
return 0;
}
+ 2
wlcm .
Even I am from India
+ 1
in turbo c++ we can use goto function
like
statement;
function 1;
function 2;
.
.
.
.
.
function n;
goto statement;
but in sololearn if I type goto it is printed in pink color so I have doubt about it how to use goto.....
+ 1
thank you
+ 1
hi thanks for the code I tried it and it worked...
+ 1
I am from India
(to Esther Fadumiye)
thanks for your answers...
+ 1
you should NEVER use a goto statments.
+ 1
pls correction I am a bo y and my name is Ayo and not esther. that's My mom name and pic
0
hi. I'm new. my name is Ayo, I'm using my mum's email
0
can you teach more
0
don't know
0
sorry. in detail pls
0
we should find the answer of it...
0
kk
0
can't find anything, can you?
0
me too
0
where re u from
0
thank you for your code and nice code......
0
-why-