how do i work bool!
- by user350217
HI! im a beginner and im really getting frustrated with this whole concept. i dont understand how to exactly use the bool function. i know what it is but i cantfigure out how to make it work in my program. Im trying to say that if my variable "selection" is any letter beween 'A' and 'I' then it is valid and can continue on to the next function which is called calcExchangeAmt(amtExchanged, selection). if it is false i want it to ask the user if they want to repeat the program and if they agree to repeat i want it to clear the screen and restart to the main function. please help edit my work!
this is my bool function:
bool isSelectionValid(char selection, char yesNo, double amtExchanged)
{
bool validData;
validData = true;
if((selection >= 'a' && selection <= 'i') || (selection >= 'A' && selection <= 'I'))
{
validData = calcExchangeAmt (amtExchanged, selection);
}
else(validData == false);
{
cout<<"Do you wish to continue? (Y for Yes / N for No)";
cin>>yesNo;
}
do
{
main();
}
while ((yesNo =='y')||(yesNo == 'Y'));
{
system("cls");
}
return 0;
}
this is the warning that im gettng:
warning C4800: 'double' : forcing value to bool 'true' or 'false' (performance warning)