New course! Every coder should learn Generative AI!
Try a free lesson0
Why would you need to use the not operator?
2 Answers
+ 1
if(age != 18)
cout << "you are not 18 years old";
Also used a lot in Boolean.
if(!t)
you could use if(false), but you could have t declared as a Boolean variable.
0
in some programs we need to invert logical results