1/31/00
COM1100 Winter2000 Yuhong Yin
15
! operator
nThe NOT (!) operator is used to change an expression to its opposite state.
nIf the expression has any nonzero value (true), !expression produce a zero value (false).
nIf an expression is false to begin with (has a zero value), !expression will be true.
nint x = 5, y =8;
n if ( ! ( (y –x) > 3 ) )
n cout << “Good Morning!” << endl;
n   else  
n cout << “Good Afternoon!” << endl;
n//will print: Good Morning!
n