I use '!' like this:
Code:
cout<<"Enter the Password: ";
cin>> Code1;
if ( ! strcmp ( Code1, "Quit" ) || ! strcmp ( Code1, "quit" ) ){
exit( 0 );
}
And if you enter "Quit" or "quit" the program quit. Else, he compares the Password.
It is the same as:
if ( strcmp ( Code1, "Quit" ) == 0 || strcmp ( Code1, "quit" ) == 0 ){
exit( 0 );
}
But '!' is smaller then '== 0'.
And of corse have those two the same effect:
if ( strcmp ( Code1, "Quit" ) != 0 || strcmp ( Code1, "quit" ) != 0 ){
exit( 0 );
}
if ( strcmp ( Code1, "Quit" ) || strcmp ( Code1, "quit" ) ){
exit( 0 );
}