Sunday, July 26, 2009

Simple C++ question. When to use bool?

I'm beginning to learn c++ and was wondering when it's appropriate to use bool. I hardly every use bool because I simply do if statements with logical operators (AND, OR, and NOT). Any advice?

Simple C++ question. When to use bool?
Right, but you have to be putting some conditions in your if statements, right?





if( something %26amp;%26amp; somethingelse ) { }





Bools are just true/false variables - isRunning, processingDone, whatever.
Reply:You use bool (boolean) for true or false condition to control how statements flows.





For example,





if (booleanVariable==true) {


// do this if true


} else {


// do this instead if false


}

floral deliveries

No comments:

Post a Comment