1) Evaluate the following mixed-mode expressions and
list the data type of the results (*Note: be careful
with the data types of all intermediate calculations).
 10.0 * 15.0 / 2 + 4.3
 3.0 * (4 % 6) + 6
 10 + 17 % 3 + 4
A First Book of C++ 4th Edition 1
Exercise 6(a)
Using Figure 2.7 (textbook Pg 69) and assuming the variable
name rate is assigned to the byte at memory address 159,
determine the addresses corresponding to each variable
declared in the following statements. Also, fill in the correct
number of bytes with the initialization data included in the
declaration statements (Use letters for the characters and not
computer codes)
float rate;
char ch1 = ‘M’, ch2 = ‘E’, ch3 = ‘L’, ch4 = ‘T’;
double taxes;
int num, count = 0;
A First Book of C++ 4th Edition 2
Exercise 6(b)
Write a C++ program that stores the integer value
16 in the variable length and the integer value 18
in the variable width. Have a program calculate
the value assigned to the perimeter variable,
using the following formula:
perimeter = 2 x (length + width)
A First Book of C++ 4th Edition 3
Exercise 6(c)

Exercise6 ch2

  • 1.
    1) Evaluate thefollowing mixed-mode expressions and list the data type of the results (*Note: be careful with the data types of all intermediate calculations).  10.0 * 15.0 / 2 + 4.3  3.0 * (4 % 6) + 6  10 + 17 % 3 + 4 A First Book of C++ 4th Edition 1 Exercise 6(a)
  • 2.
    Using Figure 2.7(textbook Pg 69) and assuming the variable name rate is assigned to the byte at memory address 159, determine the addresses corresponding to each variable declared in the following statements. Also, fill in the correct number of bytes with the initialization data included in the declaration statements (Use letters for the characters and not computer codes) float rate; char ch1 = ‘M’, ch2 = ‘E’, ch3 = ‘L’, ch4 = ‘T’; double taxes; int num, count = 0; A First Book of C++ 4th Edition 2 Exercise 6(b)
  • 3.
    Write a C++program that stores the integer value 16 in the variable length and the integer value 18 in the variable width. Have a program calculate the value assigned to the perimeter variable, using the following formula: perimeter = 2 x (length + width) A First Book of C++ 4th Edition 3 Exercise 6(c)