I must say, nesting If's to decide whether the program closes or not doesn't sound much useful.
Also nested if's and else's are usually the lack of the operand && as you can easily make a check in the same line.
if(opt1==true){
if(opt2==true){
cout<<"alsas";
}else{
cout<<"Missing 2"<<endl;
}
}else{
cout<<"Missing 1"<<endl;
}
The code above could be coded like:
if( (opt1==true) && (opt2==true) ){
cout<<"alsas";
}else if(opt2!=true){
cout<<"Missing 2"<<endl;
}else{
cout<<"Missing 1"<<endl;
}
If you want to perform something untill you get an input you should simply make a while().
Like:
while(strncasecmp(option, "exit", 4) != 0){
//yourcode
}
return 0; // or exit(0);
Anyhow I made some stupid thing, I don't know if it's any helpful, hope it is.
int main (int argc, char * argv[]){
bool opt=false;
cout<<"Insert a number"<<endl;
while(opt==false){
cin>>mynum;
if((mynum >0)&& (mynum<100)){
cout<<mynum*mynum<<endl;
cout<<"Do you wish to continue? or exit?"<<endl;
if((strncasecmp(option, "exit", 4)) == 0){
opt=true;
}else if((strncasecmp(option, "continue", 12)) == 0){
cout<<"You can simply insert a number if you wish to continue"<<endl;
}
}
}
return 0;
}