STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 8.11, Problem 8.26CP
Program Plan Intro
Three dimensional arrays:
C++ allows the array to have multiple dimensions; it does not restrict the number of dimensions.
- The multiple sets of data are modeled in one or more dimensions.
Consider the following example which shows the array with three dimensions:
// Declare three-dimensional array
double sets[2] [4] [6];
- In the above code, the array is created with three dimensions as two sets of four rows and each row contains six elements in it.
The diagrammatic representation for the above code snippet is as follows:
- Arrays with more than two dimensions are too complex to view the dimension but it helps in
programming problems.
Thus, the C++ program allows programmers to create arrays with three or more dimensions.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
A DVD rental store keeps DVDs on 50 racks with 10 shelves each. Each shelf holds 25 DVDs. Define a 3D array to represent this storage system.
DVDs are stored on 50 racks with ten shelves each at a DVD rental facility.
Each shelf has a capacity of 25 DVDs.
Create a three-dimensional array to represent this storage system.
A video rental store keeps DVDs on 50 racks with 10 shelves each. Each shelfholds 25 DVDs. Define a three-dimensional array large enough to represent thestore’s storage system.
Chapter 8 Solutions
STARTING OUT WITH C++ MPL
Ch. 8.3 - Define the following arrays: A) empNum, a 100...Ch. 8.3 - Prob. 8.2CPCh. 8.3 - Prob. 8.3CPCh. 8.3 - Assume a program includes the following two...Ch. 8.3 - What is array bounds checking? Does C++ perform...Ch. 8.3 - What is the output of the following code? int...Ch. 8.3 - Complete the following program skeleton so it will...Ch. 8.7 - Define the following arrays: A) ages, a 10-element...Ch. 8.7 - Indicate if each of the following array...Ch. 8.7 - Prob. 8.10CP
Ch. 8.7 - Given the following array definition: int values...Ch. 8.7 - Prob. 8.12CPCh. 8.7 - Prob. 8.13CPCh. 8.7 - What is the output of the following code? const...Ch. 8.9 - Write a typedef statement that makes the name...Ch. 8.9 - Prob. 8.16CPCh. 8.9 - What is the output of the following program...Ch. 8.9 - The following program segments, when completed,...Ch. 8.11 - Prob. 8.19CPCh. 8.11 - Prob. 8.20CPCh. 8.11 - Prob. 8.21CPCh. 8.11 - Prob. 8.22CPCh. 8.11 - Prob. 8.23CPCh. 8.11 - Fill in the empty table below so it shows the...Ch. 8.11 - Write a function called displayArray7. The...Ch. 8.11 - Prob. 8.26CPCh. 8.12 - Prob. 8.27CPCh. 8.12 - Write definition statements for the following...Ch. 8.12 - Define gators to be an empty vector of ints and...Ch. 8.13 - True or false: The default constructor is the only...Ch. 8.13 - True or false: All elements in an array of objects...Ch. 8.13 - What will the following program display on the...Ch. 8.13 - Complete the following program so that it defines...Ch. 8.13 - Add two constructors to the Product structure...Ch. 8.13 - Prob. 8.35CPCh. 8.13 - Prob. 8.36CPCh. 8.13 - Prob. 8.37CPCh. 8.13 - Write the definition for an array of five Product...Ch. 8.13 - Write a structure declaration called Measurement...Ch. 8.13 - Write a structure declaration called Destination ,...Ch. 8.13 - Define an array of 20 Destination structures (see...Ch. 8 - The ________ indicates the number of elements, or...Ch. 8 - The size declarator must be a(n) _______ with a...Ch. 8 - Prob. 3RQECh. 8 - Prob. 4RQECh. 8 - The number inside the brackets of an array...Ch. 8 - C++ has no array ________ checking, which means...Ch. 8 - Prob. 7RQECh. 8 - If a numeric array is partially initialized, the...Ch. 8 - If the size declarator of an array definition is...Ch. 8 - Prob. 10RQECh. 8 - Prob. 11RQECh. 8 - Prob. 12RQECh. 8 - Arrays are never passed to functions by _______...Ch. 8 - To pass an array to a function, pass the ________...Ch. 8 - A(n) ________ array is like several arrays of the...Ch. 8 - Its best to think of a two -dimensional array as...Ch. 8 - Prob. 17RQECh. 8 - Prob. 18RQECh. 8 - When a two -dimensional array is passed to a...Ch. 8 - When you pass the name of an array as an argument...Ch. 8 - Look at the following array definition. int values...Ch. 8 - Given the following array definition: int values...Ch. 8 - Prob. 23RQECh. 8 - Assume that array1 and array2 are both 25-element...Ch. 8 - Prob. 25RQECh. 8 - How do you establish a parallel relationship...Ch. 8 - Look at the following array definition. double...Ch. 8 - Prob. 28RQECh. 8 - Prob. 29RQECh. 8 - Prob. 30RQECh. 8 - Prob. 31RQECh. 8 - The following code totals the values in each of...Ch. 8 - Prob. 33RQECh. 8 - Prob. 34RQECh. 8 - In a program you need to store the identification...Ch. 8 - Prob. 36RQECh. 8 - Prob. 37RQECh. 8 - Prob. 38RQECh. 8 - Each of the following functions contains errors....Ch. 8 - Soft Skills Diagrams are an important means of...Ch. 8 - Perfect Scores 1. Write a modular program that...Ch. 8 - Larger Than n Create a program with a function...Ch. 8 - Roman Numeral Converter Write a program that...Ch. 8 - Chips and Salsa Write a program that lets a maker...Ch. 8 - Monkey Business A local zoo wants to keep track of...Ch. 8 - Rain or Shine An amateur meteorologist wants to...Ch. 8 - Lottery Write a program that simulates a lottery....Ch. 8 - Rainfall Statistics Write a modular program that...Ch. 8 - Lo Shu Magic Square The Lo Shu Magic Square is a...Ch. 8 - Baseball Champions This challenge uses two files...Ch. 8 - Chips and Salsa Version 2 Revise Programming...Ch. 8 - Stats Class and Rainfall Statistics Create a Stats...Ch. 8 - Stats Class and Track Statistics Write a client...Ch. 8 - Prob. 14PCCh. 8 - Drivers License Exam The State Department of Motor...Ch. 8 - Array of Payro11 Objects Design a PayRoll class...Ch. 8 - Drink Machine Simulator Create a class that...Ch. 8 - Bin Manager Class Design and write an object...Ch. 8 - Tic-Tac-Toe Game Write a modular program that...Ch. 8 - Theater Ticket Sales Create a TicketManager class...
Knowledge Booster
Similar questions
- A is a 2D-array with the range [-5.....5, 3.....13] of elements. The starting location is 100. Each element occupies 2 memory cells. Calculate the location of A[0] [8] using column major order.arrow_forwardA minimax or saddle point in a two-dimensional array is an element that is the minimum of its row and the maximum of its column, or vice verse. For example, in the following array11 22 33 33 99 55 66 77 77 44 99 22the element 33 is a minimax because it is the maximum of row 0 and the minimum of column 2. The element 55 is another minimax because it is the minimum of row 1 and the maximum of column 1.Write a program that reads a 4-by-3 matrix, and then prints the location and value of each minimax in the matrix. For example, it would printa[0][2] = 33 is a minimax a[1][1] = 55 is a minimaxfor the matrix shown above.arrow_forwardWrite a program to create a three- dimensional array of integers. Where each matrix consists of two rows and three columns.arrow_forward
- 1. Take an array of size 5x5 and initialize it with random numbers of range 1 to 10, now addall the elements of the 2D array and display sum.2. Calculate the total/sum of all the values in the array.Example:Array:2 3 5 3 14 5 1 2 14 7 3 2 02 1 1 5 11 7 8 9 0Sum array: 78 3. Sum all the element in each column and display output.Example:Array:2 3 5 3 14 5 1 2 14 7 3 2 02 1 1 5 11 7 8 9 0Sum array:13 23 18 21 3 4. Perform sum of all the elements of the arrays whose row number and column numberboth are odd. Display the final sum.Example:Array:2 3 5 3 14 5 1 2 14 7 3 2 02 1 1 5 11 7 8 9 0Sum array: 13Note: create function for each taskarrow_forwardSuppose the weekly hours for all employees are stored in a two-dimensional array. Each row records an employee's seven-day work hours with seven columns. For example, the following array stores the work hours for eight employees. Su MTW Th F Sa Su Employeel 0 Employee2 1 Employee3 2 Employee4 3 Employees 7 Employee6 5 Employee7 6 Employee8 7 52 2 2 13 7 34 4 3. 4 4 34 9 34 6 8 3 3. 32 2 by Java code 3 4 6. 3 4 4 6 3 4 374 8 3 8 6 35 9 87 4 4 27 Write a program that Prompt the user to enter number of employees Prompt the user to enter the employees names and save their names in a one dimensional array. (Check for availability if name exist, no duplicate names) For each employee, enter the seven-day work hours and save them in a two dimensional array. Compute the total hours worked by each employee and save them in one dimensional array. Compute the wages of employees as follows: up to 40 hours per week the hour price is 20 otherwise the overtime hour price is 1.2 regular hour price.…arrow_forward"John is very interested in history and all the generations of his family. He does a lot of research and realizes that he is descended from the great Mayan dynasty. After a lot of searching through ancient records and the latest records of the society, he is able to find out all the parent-child relationships in his family all the way from the great emperor Ming of the dynasty to himself These relationships are given in the form of a linear array where the emperor is at the first position and his children are at pos (2i + 1) and (2i + 2) Subject: Java Programming This is the pattern followed throughout. Henry wants to figure out all the siblings of the person X from the data. Return the sorted list of all of john's siblings. If no sibling return {-1} input 1: N, the length of the arrayinput2: An array representing the ancestral treeinput 3: X, the person whose siblings are sought. output - return the array of all siblings in increasingly sorted order. Examples : input…arrow_forward
- Given are a 5x6 matrix A, a 3 x 6 matrix B, and a 9-element vector v. 25 8 11 14 17 5 10 15 20 25 30 30 35 40 45 50 55 55 60 65 70 75 80 B = 3 6 9 12 15 18 47 10 13 16 19 5 8 11 14 17 20 69 12 15 18 21 A = 99 98 97 96 95 94 93 92 91 y = Create the three arrays in the Command Window, and then, by writing one com- mand, replace the last four columns of the first and third rows of A with the first four columns of the first two rows of B, the last four columns of the fourth row of A with the elements 5 through 8 of v, and the last four columns of the fifth row of A with columns 3 through 5 of the third row of B.arrow_forwardMake a two-dimensional array to hold the three selling items for each of the five artists. The artist names must be stored in a single array.arrow_forwardA 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the elements of the diagonal that does NOT include the first element of the first row are all equal.arrow_forward
- 2. Use a two-dimensional (double-subscripted) array to solve the following problem: A company has four salespeople who sell five different products. Let each salesperson represent a row of your array and each product a column. You now have a 4 x 5 array. Once a day, each salesperson submits a slip for each different type of product he or she sold. Each slip contains: The salesperson’s number (1 to 4) (use this to get row subscript) The product number (1 to 5) (use this to get column subscript) The total dollar value of that product sold that day Thus, each salesperson submits from 0 to 5 sales slips per day (0, if they made no sales that day; and 5, if they sold every product that day). Your program will read a file that contains the information from all of the sales slips for the last month. Read until EOF. The file is named "productSales.txt". You need to create this file with at least 10 entries. Remember that the first number is the salesperson, the second number is the product,…arrow_forwardGiven an 8-element array: A = {x1, X2, X3, X4, X5, X6, 7, x8}, we would like to find its 3rd smallest element. It is known that x₁ and 8 are the two extreme elements: max and min, but we do not know which one is the max and which one is the min. It is also known that x4 and x5 are the two medians: left-median and right-median. What is the minimum number of comparisons you need to find the 3rd smallest element of the original array? Ans:arrow_forwardFind the largest value in a non-square array consisting of (4 rows, 5 columns)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr