I am a student programmer currently designing a GUI for my company with Qt and I have a rather simple question that I just cant seem to find the answer to on the web. It seems like someone has had to of asked it before so if you know where the answer is Id be happy with a reference. My question is; can a Boolean datatype in c++ be handled using an if statement. So a bool value is either one or zero so can you do something like this
bool trueOrFalse() < myclass temp; QString tempstr; double candidate; bool validate; tempstr = ui->tableWidgetInjectionLocations->item(i,9)->text(); candidate = tempstr.toDouble(&validate); if(validate == true) < temp.tempProperty = candidate; >else < QMessageBox error; error.setText("Error"); error.exec(); >if (validate == true) < return true; >else < return false; >>
What I am really looking for here is in the last section of this bool function. When I use return am I actually returning a value that this function would then hold or am I using a the keyword return inappropriately? Once validation has past Id like to be able to use the function to indicate whether or not to proceed in another function Please keep my criticism constructive please. As a student I am only interested in improving.