I've split the menu and the actual action functions, but I encountered a warning - the app still compiled correctly - it's just that warnings annoy me and the fact that the code won't compile correctly on some other compilers leaves that irking feeling at the back of my mind. Anyway, I've narrowed it down to one main function, being the action() or switchmain() as I've labelled it. The error says
Code:
warning C4715: 'switchmain' : not all control paths return a value
Now, I'm thinking that since it has a switch scenario inside the function returning a value (case 0 : return 0) and that anything outside the case scenario is just being left to void(). Since I can't just go and label it void switchmain() because the function itsself is returning a 0 in one part of it, can't I just place a return true; outside the case scenario to remedy that, just as long as I keep the function initiator to something like short int/int switchmain()?
Here's the code:
Code:
short int switchmain(int choice)
{
switch (choice)
{
case 1 : hp_rpm();
break;
case 2 : tq_rpm();
break;
case 3 : hp_tq();
break;
case 4 : ver_info();
break;
case 0 :
cout<<"Please wait, halting program..."<<endl<<endl;
wait();
return 0;;
break;
default:
cout<<"Error, bad input, quitting"<<endl<<endl;
}
return true;
}
I just want to know if I'm doing this right