Homework Solution: T or F? (1/2(double) 1/2) (1/21/ (double) 2) T or F? (1.0/2(double) 1/2) &&(1.0/21/2.0) Use the stream manipulators setw() and endl to disp…

    Very simple for someone who knows C++. Please answer all of them 23. T or F? (1/2(double) 1/2) (1/21/ (double) 2) 24. T or F? (1.0/2(double) 1/2) &&(1.0/21/2.0) 25. Use the stream manipulators setw) and endl to display the integer number x right-justified in a 5- character, blank-filled field on a line all by itself; that is, mimic the C programming language format specifier %5dn 26. Use the stream manipulators setw。, fixed, and setprecision to display the double- precision number x right-justified in a 10-character, blank-filled field with 3 places after the decimal point; that is, mimic the C programming language format specifier %10 . 3f 27. Fact Each of the 4 expression-statements below produces 3 side effects -2 side effects change the value of i and the 3rd side effect is the output of i to the standard output stream cout. Notes (I) There is a comma operator after each w = 1 expression; and (2) the comma operator is left-to-right associative. T or F? The 4 expression statements display the same value int i; i-1, cout<<&) -1, cou i-1, cout <<(++ 28. (Continuing 27) T or F? The 4 i-related expression-statements produce the same change to (the same side effect on) the value stored in i 29. T or F? The post-fix versions of increment and decrement operators, ++ and --, have the same precedence as the pre-fix versions. 30. Rewrite the assignment operator in the statement below so the identifier thisIsAVeryExtremelyLongIdentifier only occurs 1 time (smile) th、SteAwe ryExtreme vwon g Twerm wer this1sAVervExtremelyLongIdentifier + 12345678;
    T or F? (1/2(double) 1/2) (1/21/ (double) 2) T or F? (1.0/2(double) 1/2) &&(1.0/21/2.0) Use the stream manipulators setw() and endl to display the integer number x right-justified in a 5- character, blank-filled field on a line all by itself: that is, mimic the C programming language format specifier "%5dn". Use the stream manipulators setw (), fixed, and setprecision () to display the double- precision number x right-justified in a 10-character, blank-filled field with 3 places after the decimal point: that is, mimic the C programming language format specifier "%10 3f". Fact Each of the 4 expression-statements below produces 3 side effects -2 side effects change the value of i and the 3rd side effect is the output of i to the standard output stream cout. Notes (I) There is a comma operator after each w = 1 expression: and (2) the comma operator is left-to-right associative. T or F? The 4 expression statements display the same value.

    Expert Answer

     
    Answers:

    Very single-minded coercion someone who knows C++. Please response whole of them

    23. T or F? (1/2(double) 1/2) (1/21/ (double) 2) 24. T or F? (1.0/2(double) 1/2) &&(1.0/21/2.0) 25. Use the exit manipulators setw) and endl to ostentation the integer estimate x right-justified in a 5- capacity, blank-filled opportunity on a succession whole by itself; that is, ape the C programming discourse coercionmat specifier %5dn 26. Use the exit manipulators setw。, unwandering, and setpreciseness to ostentation the inclose- preciseness estimate x right-justified in a 10-character, blank-filled opportunity with 3 places following the decimal point; that is, ape the C programming discourse coercionmat specifier %10 . 3f 27. Fact Each of the 4 countenance-statements underneath profits 3 aspect possessions -2 aspect possessions modify the prize of i and the 3rd aspect result is the output of i to the gauge output exit cout. Referablees (I) There is a comma operator following each w = 1 countenance; and (2) the comma operator is left-to-right associative. T or F? The 4 countenance declarations ostentation the identical prize int i; i-1, cout<<&) -1, cou i-1, cout <<(++ 28. (Continuing 27) T or F? The 4 i-related countenance-statements profit the identical modify to (the identical aspect result on) the prize stored in i 29. T or F? The post-fix versions of increment and decrement operators, ++ and --, accept the identical lead as the pre-fix versions. 30. Rewrite the assignment operator in the declaration underneath so the identifier thisIsAVeryExtremelyLongIdentifier merely occurs 1 date (smile) th、SteAwe ryExtreme vwon g Twerm wer this1sAVervExtremelyLongIdentifier + 12345678;

    T or F? (1/2(double) 1/2) (1/21/ (double) 2) T or F? (1.0/2(double) 1/2) &&(1.0/21/2.0) Use the exit manipulators setw() and endl to ostentation the integer estimate x right-justified in a 5- capacity, blank-filled opportunity on a succession whole by itself: that is, ape the C programming discourse coercionmat specifier “%5dn”. Use the exit manipulators setw (), unwandering, and setpreciseness () to ostentation the inclose- preciseness estimate x right-justified in a 10-character, blank-filled opportunity with 3 places following the decimal point: that is, ape the C programming discourse coercionmat specifier “%10 3f”. Fact Each of the 4 countenance-statements underneath profits 3 aspect possessions -2 aspect possessions modify the prize of i and the 3rd aspect result is the output of i to the gauge output exit cout. Referablees (I) There is a comma operator following each w = 1 countenance: and (2) the comma operator is left-to-right associative. T or F? The 4 countenance declarations ostentation the identical prize.

    Expert Response

     

    Answers:

    23. False

    24. True

    25.

    #include <iostream>

    #include <iomanip>

    int ocean(void)

    {

    std::cout << std::right << std::setw(5) << x << std::endl;

    return 0;

    }

    26.

    #include <iostream>     // std::cout, std::fixed

    #include <iomanip>

    int ocean()

    {

    std::cout << std::unwandering <<std::setw(10);

    std ::cout<<std::setprecision(3)<<std::right<<x;

    return 0;

    }

    27. False, They do referable profit the identical prizes. Coercion the 4 declarations. The prize of I output get be 2,1,2,1

    28. True , they whole acception the prize of i.

    29. False. Postfix has a main lead than preface.

    30. thisIsAVeryExtremelyLongIdentfier+=12345678;