
LANGUAGE: C++
CHALLENGE:
Write a statement that toggles the value of the bool variable onOffSwitch . That is, if onOffSwitch is false , its value is changed to true ; if onOffSwitch is true , its value is changed to false.
SOLUTION:
if(onOffSwitch){ onOffSwitch = false; }else{ onOffSwitch = true; }
For C
onOffSwitch = !onOffSwitch;
thank you… this website has help me a lot and still is…my visitation will be often since my class just started…lol