?: conditional operator

I am trying to use the ?: operator so that it doesn't return anything if the condition is false:

 
cout << "whatever I want to say..." << (newline==true ? endl);


However the compiler throws an error saying:

error C2143: syntax error : missing ',' before ')'


What am I doing wrong? Thanks for your help in advance...
The ternary operator requires the ':' and all its results to have the same type, try this:
cout << "whatever I want to say..." << (newline==true ? '\n' : '\0' );
'\n' is the new line character and '\0' is the string terminator character (not displayed)
Thanks for explaining :)
Topic archived. No new replies allowed.