Can I ask on how to use the goto statement because here in my program I am using Function and inorder to go back from the top I use goto statement.. Why isn't it working??
#include<iostream>
using namespace std;
void rankE(){
cout<<"Rank: E "<<endl<<endl;
}
void rankD(){
cout<<"Rank: D "<<endl<<endl;
}
void rankC(){
cout<<"Rank: C "<<endl<<endl;
}
void rankB(){
cout<<"Rank: B "<<endl<<endl;
}
void rankA(){
cout<<"Rank: A "<<endl<<endl;
}
void bugo(){
cout<<"Bugo kaayu ka!! HAHA "<<endl<<endl;
}
void genius(){
cout<<"Char!!subraan ra sad ka's ka bright !! ABNO ka na !! hakhak'... "<<endl<<endl;
}
int main(){
int grade;
char goBack,y,n;
back:
cout<<"Enter Grade:";
cin>>grade;
if(grade==50|grade==51|grade==52|grade==53|grade==54|grade==55|grade==56|grade==57|grade==58|grade==59|grade==60){
rankE();
}
if(grade==61|grade==62|grade==63|grade==64|grade==65|grade==66|grade==67|grade==68|grade==69|grade==70){
rankD();
}
if (grade==71|grade==72|grade==73|grade==74|grade==75|grade==76|grade==77|grade==78|grade==79|grade==80){
rankC();
}
if(grade==81|grade==82|grade==83|grade==84|grade==85|grade==86|grade==87|grade==88|grade==89|grade==90){
rankB();
}
if(grade==91|grade==92|grade==93|grade==94|grade==95|grade==96|grade==97|grade==98|grade==99|grade==100){
rankA();
}
if(grade<50){
bugo();
}
if(grade>100){
genius();
}
cout<<"Do you want to go back (y/n)??";
cin>>goBack;
if(goBack==y){
goto back;
}
if(goBack==n){
cout<<"Sayonara !! ^_^ ";
}
}