it sounds simple but everything i try doesnt work, im usin visuall c++
it sounds simple but everything i try doesnt work, im usin visuall c++
Turning Boolean functions off? A bool function returns a bool
value, you cant just give it a true or false value.
as for a normal bool justCode:bool test; test=true; test=false;
>it sounds simple but everything i try doesnt work
I think you have a function to turn something on and off, a toggle-function, which does not work as you expected. Maybe you could post your function and explain what it should do according to you.
I also think that you should post more explanations to your question...
But I guess maybe you are asking about how to return a value for a bool function... If that's what you want it like this:
it's just as same as any other function except you can only return true of false!Code:bool function(void) { return true; //this returns true //or you can type return false; istead! }
none...
Code:bool state; void myToggleFunc() { state = !state; }
dont you mean
i think that is what you meanCode:bool state; // i recommend initializing it..but if nots its automatically true (1) void myToggleFunc(bool& vstate) // since you are not returning anything you would want to // pass this by reference to change the data { vstate = !vstate; // since state was true now state is false }
nextus, the samurai warrior