they typically have the same result only during comparisons , like in loops or if statements , other wise , "!" operator returns the complement of the number a. And of course you cannot use "==" other than during comparison statements. One more thing , the above may be true only if the operators are not overloaded.
Thanks a lot. ^_^
But I think in this example while(!(nbr == 5))
can also be replaced with while((nbr == 5)==0)
to some extent, there is still no difference.