Chapter 4
1: | How would you declare each of the following?
|
A1: |
|
2: | Declare an array of five ints and initialize it to the first five odd positive integers. |
A2: |
int oddly[5] = {1, 3, 5, 7, 9}; |
3: | Write a statement that assigns the sum of the first and last elements of the array in question 2 to the variable even. |
A3: |
int even = oddly[0] + oddly[4]; |
4: | Write a statement that displays the value of the second element in the float array ideas. |
A4: |
cout << ideas[1] << "\n"; // or << endl; |
5: | Declare an array of char and initialize it to the string ... |
Get C++ Primer Plus, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.