Ch 3 - Relational operators > > < <= =!= Greater than or less than = tests for quality!= not equal Logical operators | and operator | = logical or

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Relational operators : > >+ < <= == != Greater than or less than. == - tests for quality. != - not equal && - “and” operator || = logical ‘or’, if it sees a true anywhere in the statement it will return true. It needs everything to be false for it to be return false. ! – takes logical value and converts it. If value is true, it will make it false or vise versa on it’s right hand side Cout << (1> 2) << “\n\n”; - produces a zero which is considered false. A non-zero is a true statement Cout << (1> 2) & (3>4) Cout << (1<2) || (3> 4) ) << “\n\n”; will return true • If statement, if-else statement, if-else if-else statement Int x; Cout<< “please enter value of x”; Cin >> x; If(x > 2) ( Cout << “x is greater than 2 \n\n”; ) cout << “after if statement \n\n”; OR If(x > 2) Cout << “x is greater than 2 \n\n”;(must be under if) cout << “after if statement \n\n”; If(x > 2) ( Cout << “x is greater than 2 \n\n”;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/24/2009 for the course ECE 1574 taught by Professor Rpbroadwater during the Spring '08 term at Virginia Tech.

Page1 / 5

Ch 3 - Relational operators > > < <= =!= Greater than or less than = tests for quality!= not equal Logical operators | and operator | = logical or

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online