Chapter 07 - Answers to Review Questions PDF

Title Chapter 07 - Answers to Review Questions
Author Deepak Menon
Course C++ Programming: Objects
Institution Riverside City College
Pages 10
File Size 111.8 KB
File Type PDF
Total Downloads 51
Total Views 176

Summary

Download Chapter 07 - Answers to Review Questions PDF


Description

Name Deepak Menon Answers to Review Questions Chapter 7 1.

The size declarator is used in a definition of an array to indicate the number of elements the array will have. A subscript is used to access a specific element in an array. The array has 10 elements. The subscript of the first element is 0. The subscript of the last element is 9. Using four-byte integers, this array uses 40 bytes of memory. Because, with the array alone the function has no way of determining the number of elements it has. 2 14 8 By providing an initialization list. The array is sized to hold the number of values in the list. 3 0 Because an array name without brackets and a subscript represents the array's beginning memory address. The statement shown attempts to assign the address of array2 to array1, which is not permitted. No. By reference. The array's beginning memory address. By using the same subscript value for each array. Eight rows Ten columns Eighty elements sales[7][9] = 123.45; The second size declarator, which is for the number of columns.

2.

3. 4.

5. 6. 7.

8. 9. 10. 11. 12.

13. 14.   

You do not have to declare the number of elements that a vector will have. If you add a value to a vector that is already full, the vector will automatically increase its size to accommodate the new value. A vector can report the number of elements it contains.

Find the Error 80. 81. 82. 83. 84. 85.

The size declarator cannot be a variable. The size declarator cannot be negative. The loop will write data past the end of the array. The initialization list must be enclosed in braces. Two of the initialization values are left out. For the array to be implicitly sized there must be an initialization list.

Name Deepak Menon 86. 87. 88. 89.

A null terminator must be specified in the initialization list. The assignment operator cannot be used to assign the contents of one array to another, in a single statement. The parameter should be declared as int nums[]. Also, the function should have a parameter to hold the size of the array. The parameter must specify the number of columns, not the number of rows.

Challenge Booksellers Software Development // ******************************************************** // Starting Out with C++ * // From Control Stuctures through Objects * // seventh edition * // * // Chapter 7 Arrays * // * // Booksellers Software Development * // Project — Part 7: A Problem-Solving Exercise * // * // Single-File Program * // ******************************************************** #include "mainmenu.h" #include #include #include using namespace std; // Constant for array sizes const int SIZE = 20; // Global Arrays string bookTitle[SIZE]; string isbn[SIZE]; string author[SIZE]; string publisher[SIZE]; string dateAdded[SIZE]; int qtyOnHand[SIZE]; double wholesale[SIZE]; double retail[SIZE]; int main() { int choice = 0;

// To hold the user's menu choice

// Display the menu until the user selects item 4 while (choice != 4) { cout...


Similar Free PDFs