For each of the following, write C++ statements that perform the specified task. Assume that double-precision, floating-point numbers are stored in eight bytes and that the starting address of the built-in array is at location 1002500 in memory. Each part of the exercise should use the re- sults of previous parts where appropriate.

a) Use a for statement to display the elements of built-in array numbers using pointer/off- set notation with the built-in array’s name as the pointer.
b) Use a for statement to display the elements of built-in array numbers using pointer/sub- script notation with pointer nPtr.
c) Refer to the fourth element of built-in array numbers using array subscript notation, pointer/offset notation with the built-in array’s name as the pointer, pointer subscript notation with nPtr and pointer/offset notation with nPtr.
d) Assuming that nPtr points to the beginning of built-in array numbers, what address is referenced by nPtr + 8? What value is stored at that location?
e) Assuming that nPtr points to numbers[5], what address is referenced by nPtr after nPtr
-= 4 is executed? What’s the value stored at that location?


```
a) cout << fixed << showpoint << setprecision(1);
for (size_t k{0}; k < size; ++k) {
cout << *(numbers + k) << ' ';
}
b) cout << fixed << showpoint << setprecision(1);
for (size_t m{0}; m < size; ++m) {
cout << nPtr[m] << ' ';
}
c) numbers[3]
*(numbers + 3)
nPtr[3]
*(nPtr + 3)
d) The address is 1002500 + 8 * 8 = 1002564. The value is 8.8.
e) The address of numbers[5] is 1002500 + 5 * 8 = 1002540.
The address of nPtr -= 4 is 1002540 - 4 * 8 = 1002508. The value at that location is 1.1.
```

Computer Science & Information Technology

You might also like to view...

A priority queue can be implemented using

a) a list of queues b) a minheap c) a stack d) both a) and b) are correct e) all of a), b), and c) are correct

Computer Science & Information Technology

A __________ allows users to enter multiple lines of text.

A. text area B. text box C. label D. fieldset

Computer Science & Information Technology

Answer the following statement(s) true (T) or false (F)

1. Tweened frames are not editable. 2. If a frame contains more than one layer with movement or opacity changes, the All Layers options in the Tween dialog box will tween each layer. 3. You can choose to have an animation display just once, a specified number of times, or repeat continuously. 4. Photoshop files that contain animation are smaller than other files. 5. If your animation does not play, your browser might not permit Java controls.

Computer Science & Information Technology

Which of these file types cannot be imported into Excel?

A. .txt B. .CSV C. .PDF D. CAD

Computer Science & Information Technology