hey all, i have a warning saying that not all these paths return a value, but the inner else should just continue the loop and _not_ return a value. will this cause problems? how can i express the same thing without causing these problems?
Printable View
hey all, i have a warning saying that not all these paths return a value, but the inner else should just continue the loop and _not_ return a value. will this cause problems? how can i express the same thing without causing these problems?
some code, please?
int someFunc() {
// complex conditional or loop
return 0; // Never reached
}
christ sorry, left my head someplace else today :D
Code:char Game::mf_game_displayOptions(int options)
{
char choice='h';//local only
if (options==1)
{ bool choiceCheck=false;
do
{
cout<<endl<<endl<<endl<<"count under con"<<"<B>unt, <L>eft grounder, <R>ight grounder, "
<<"<S>acrafice fly, <H>ome run"<<endl;
cin>>choice;
choice=tolower(choice);
if (choice=='b' || choice=='l' || choice=='r'
|| choice=='s' || choice=='h')
{
choiceCheck=true;
return choice;
}
else
{
clrscr();
cout<<"you've entered an invalid option, please change it.";
choiceCheck=false;
}
}while(choiceCheck==false);
}
else
{return choice;}
}
Just get rid of the the last else it it's fine.
char Game::mf_game_displayOptions(int options)
my god! you really go overboard with the naming conventions!!
dont ya think 'mf' and 'game' are a little obvious??? since the function is part of the game scope, it must be a member function of game?!
anyways, it's not important... each to his/her own i guess :D
U.
>you really go overboard with the naming conventions!!
i really like my system. in fact, i'm having it copyrighted ;)
kidding aside, i'm too much of a wuss to derive or make friend functions, so i use about a billion get functions and the names help me tell what's what in another source file.
does anyone else have a system they like? i'd like to see it :)