if expressions

Hello everyone.
I am trying to write a program for a phone bill.
Input need day min + night min.

I was wondering if i can use more then one expression in an if statement

if(expression, expression...)??

a simple example would be appreciated if possible.

THANKS
Yep, you can use logical operators.
http://www.cplusplus.com/doc/tutorial/operators/ (Scroll down to "Logical operators ( !, &&, || )")

Example:
1
2
if(itIsColdOutside && doorIsOpen) // and
    closeDoor();
Last edited on
I find it easier to use the C++ logical operator synonyms "and", "or", "not" and "xor".

1
2
if(itIsColdOutside and doorIsOpen)
    closeDoor();


It can throw some old-timers for a loop though.

http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#C.2B.2B_operator_synonyms
Thanks for your time and help.
Topic archived. No new replies allowed.