Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 7.9, Problem 7.26CP
A video rental store keeps DVDs on 50 racks with 10 shelves each. Each shelf holds 25 DVDs. Define a three-dimensional array large enough to represent the store’s storage system.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
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 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.
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 task
Chapter 7 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Ch. 7.3 - Define the following arrays: A) empNums, a...Ch. 7.3 - Prob. 7.2CPCh. 7.3 - Prob. 7.3CPCh. 7.3 - Prob. 7.4CPCh. 7.3 - What is array bounds checking? Does C++ perform...Ch. 7.3 - What is the output of the following code? int...Ch. 7.3 - The following program skeleton contains a...Ch. 7.3 - Define the following arrays: A) ages, a 10-element...Ch. 7.3 - Is each of the following a valid or invalid array...Ch. 7.6 - Given the following array definition: int values[]...
Ch. 7.6 - Given the following array definition: int nums[5]...Ch. 7.6 - Prob. 7.12CPCh. 7.6 - What is the output of the following code? (You may...Ch. 7.7 - Prob. 7.14CPCh. 7.7 - Prob. 7.15CPCh. 7.7 - When used as function arguments, are arrays passed...Ch. 7.7 - What is the output of the following program? (You...Ch. 7.7 - The following program skeleton, when completed,...Ch. 7.9 - Prob. 7.19CPCh. 7.9 - How many elements are in the following array?...Ch. 7.9 - Write a statement that assigns the value 56893.12...Ch. 7.9 - Prob. 7.22CPCh. 7.9 - Prob. 7.23CPCh. 7.9 - Fill in the table below so that it shows the...Ch. 7.9 - Write a function called displayArray7. The...Ch. 7.9 - A video rental store keeps DVDs on 50 racks with...Ch. 7.11 - Prob. 7.27CPCh. 7.11 - Write a definition statement for a vector named...Ch. 7.11 - Prob. 7.29CPCh. 7.11 - Write a definition statement for a vector named...Ch. 7.11 - Prob. 7.31CPCh. 7.11 - snakes is a vector of doubles, with 10 elements....Ch. 7 - Prob. 1RQECh. 7 - Look at the following array definition: int...Ch. 7 - Why should a function that accepts an array as an...Ch. 7 - Prob. 4RQECh. 7 - Prob. 5RQECh. 7 - Prob. 6RQECh. 7 - Prob. 7RQECh. 7 - Assuming that numbers is an array of doubles, will...Ch. 7 - Prob. 9RQECh. 7 - Prob. 10RQECh. 7 - How do you establish a parallel relationship...Ch. 7 - Prob. 12RQECh. 7 - When writing a function that accepts a...Ch. 7 - What advantages does a vector offer over an array?Ch. 7 - Prob. 15RQECh. 7 - The size declarator must be a(n) ________ with a...Ch. 7 - Prob. 17RQECh. 7 - Prob. 18RQECh. 7 - The number inside the brackets of an array...Ch. 7 - C++ has no array ________ checking, which means...Ch. 7 - Starting values for an array may be specified with...Ch. 7 - If an array is partially initialized, the...Ch. 7 - If the size declarator of an array definition is...Ch. 7 - By using the same _________ for multiple arrays,...Ch. 7 - Prob. 25RQECh. 7 - Prob. 26RQECh. 7 - To pass an array to a function, pass the ________...Ch. 7 - A(n) _______ array is like several arrays of the...Ch. 7 - Its best to think of a two-dimensional array as...Ch. 7 - Prob. 30RQECh. 7 - Prob. 31RQECh. 7 - When a two-dimensional array is passed to a...Ch. 7 - The ________________ is a collection of...Ch. 7 - The two types of containers defined by the STL are...Ch. 7 - The vector data type is a(n) ____________...Ch. 7 - Prob. 36RQECh. 7 - To store a value in a vector that docs nor have a...Ch. 7 - To determine the number of elements in a vector,...Ch. 7 - Use the _______________ member function to remove...Ch. 7 - To completely clear the contents of a vector, use...Ch. 7 - Prob. 41RQECh. 7 - Prob. 42RQECh. 7 - In a program, you need to store the identification...Ch. 7 - Prob. 44RQECh. 7 - In a program, you need to store the populations of...Ch. 7 - The following code totals the values in two...Ch. 7 - Prob. 47RQECh. 7 - Prob. 48RQECh. 7 - Prob. 49RQECh. 7 - Prob. 50RQECh. 7 - Prob. 51RQECh. 7 - T F The individual elements of an array are...Ch. 7 - T F The first element in an array is accessed by...Ch. 7 - Prob. 54RQECh. 7 - Prob. 55RQECh. 7 - T F Subscript numbers may be stored in variables.Ch. 7 - T F You can write programs that use invalid...Ch. 7 - Prob. 58RQECh. 7 - T F The values in an initialization list are...Ch. 7 - T F C++ allows you to partially initialize an...Ch. 7 - T F If an array is partially initialized, the...Ch. 7 - T F If you leave an element uninitialized, you do...Ch. 7 - T F If you leave out the size declarator of an...Ch. 7 - T F The uninitialized elements of a string array...Ch. 7 - T F You cannot use the assignment operator to copy...Ch. 7 - Prob. 66RQECh. 7 - T F To pass an array to a function, pass the name...Ch. 7 - T F When defining a parameter variable to hold a...Ch. 7 - T F When an array is passed to a function, the...Ch. 7 - T F A two-dimensional array is like several...Ch. 7 - T F Its best to think of two-dimensional arrays as...Ch. 7 - T F The first size declarator (in the declaration...Ch. 7 - T F Two-dimensional arrays may be passed to...Ch. 7 - T F C++ allows you to create arrays with three or...Ch. 7 - Prob. 75RQECh. 7 - T F To use a vector, you must include the vector...Ch. 7 - T F vectors can report the number of elements they...Ch. 7 - T F You can use the [ ] operator to insert a value...Ch. 7 - T F If you add a value to a vector that is already...Ch. 7 - int sixe; double values [size];Ch. 7 - Prob. 81RQECh. 7 - Prob. 82RQECh. 7 - Prob. 83RQECh. 7 - int numbers[8] ={1,2, , ,4, , 5};Ch. 7 - float ratings[] ;Ch. 7 - Prob. 86RQECh. 7 - Prob. 87RQECh. 7 - Prob. 88RQECh. 7 - void showValues(int nums [4][]) { For (rows = 0;...Ch. 7 - Prob. 90RQECh. 7 - Largest/Smallest Array Values Write a program that...Ch. 7 - Rainfall Statistics Write a program that lets the...Ch. 7 - Chips and Salsa Write a program that lets a maker...Ch. 7 - Larger than n In a program, write a function that...Ch. 7 - Monkey Business A local zoo wants to keep track of...Ch. 7 - Rain or Shine An amateur meteorologist wants to...Ch. 7 - Number Analysis Program Write a program that asks...Ch. 7 - Lo Shu Magic Square The Lo Shu Magic Square is a...Ch. 7 - Payroll Write a program that uses the following...Ch. 7 - Drivers License Exam The local Drivers License...Ch. 7 - Prob. 11PCCh. 7 - Grade Book A teacher has five students who have...Ch. 7 - Grade Book Modification Modify the grade book...Ch. 7 - Lottery Application Write a program that simulates...Ch. 7 - vector Modification Modify the National Commerce...Ch. 7 - World Series Champions If you have downloaded this...Ch. 7 - Name Search If you have downloaded this books...Ch. 7 - Tic-Tac-Toe Game Write a program that allows two...Ch. 7 - 2D Array Operations Write a program that creates a...Ch. 7 - Prob. 22PC
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What is denormalization?
Database Concepts (8th Edition)
Why is aluminum oxide used more frequently than silicon carbide as an abrasive?
Degarmo's Materials And Processes In Manufacturing
Describe the three types of anomalies that can arise in a table and the negative consequences of each.
Modern Database Management
Which of the following activities require real-time processing? a. Printing mailing labels b. Playing a compute...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
A file that contains a Flash animation uses the __________ file extension. a. .class b. .swf c. .mp3 d. .flash
Web Development and Design Foundations with HTML5 (8th Edition)
Determine the maximum deflection of the simply supported beam. The beam is made of wood having a modulus of ela...
Mechanics of Materials (10th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- A 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_forwardA 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_forwardAssigning the first element of an array is done by A.) intArray[1] = value B.) intArray(1) = value C.) intArray[0] = value D.) intArray(0) = value E.) None abovearrow_forward
- bläj 4 This code create the one dimension array (B) contains the positive value in .two dimension array A(4,3) 1-... 2-.... 3-.... 4-.... 5-.... 6-.... End If Next 1-K=0 2-For I = 1 To 4 3-For J=1 To 3 4-lf A(1,J) > 0 Then 5-k = k + 1 6- A(I,J) =B(k) 1-K=0 2-For I = 1 To 4 3-For J=1 To 3 4-lf A(I,J) > 0 Then 5-k = k + 1 6-B(k) = A(I,J) 1-K=0 2-For I = 1 To 4 3-For J=1 To 3 4-If A(I,J) mod 2 = 0 Then 5-k = k + 1 6-B(k) = A(I,J) %3D 1-K=0 2-For I = 1 To 3 3-For J=1 To 4 4-lf A(1,J) > 0 Then 5-k = k + 1 6-B(k) = A(I,J) %3D 1-K=1 2-For I = 1 To 4 3-For J=1 To 3 4-lf A(I,J) < 0 Then 5-k = k + 1 6-B(k) = A(I,J) %3Darrow_forwardBackground: This assignment will help you further learn to use multidimensional arrays. You will need a 10x2 matrix for this problem. Consider 10 points on a map, You need to identify the distance between each point (or vertex). A vertex requires two pieces of information. An x,y coordinate (think longitude and latitude.) This is why you have a matrix of 10x2, each entry is the two values you will need. You can think of these points a cities, or friend's houses. We're only looking for a direct route (as the crow flies) not taking roads to make it simpler. You can find the distance between any two points by use of: sqr_root((x1 - x2)^2 + (y1 - y2)^2) You will need to fill your matrix with some random values. Then you will need to calculate the distance between each possible point, eventually displaying it on a matrix in output. Think something like: 1 2 3 4 5 1 0 8 12 4 6 2 8 0 7 .... 3 12 7 .... 4 4 ... 5 6 ... Hint:…arrow_forwarduse C++ programming language A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3×7 array, where each row represents a different monkey and each column represents a different day of the week. The program should first have the user input the data for each monkey. Then it should create a report that includes the following information: Average amount of food eaten per day by the whole family of monkeys The least amount of food eaten during the week by any one monkey The greatest amount of food eaten during the week by any one monkey.arrow_forward
- Q1: Find the array (B) from the array (A) [10 01 A = 0 1 0 LO 0 1 & B = -3 0 0 0 -3 0 25 points 0 0 -31arrow_forwardUse C Language Write a program that creates an array of N names. Each name has 5 exam scores. Output the names with the highest and lowest average scores.arrow_forwardJava program 2D ARRAYarrow_forward
- Write a basketball program such that it implements a two-dimensional array for 5 players whose score is entered into the array.arrow_forwardIn C program Given a 2D array, determine if there is a row or a column that has the same numbers all throughout. Input The first line contains the number of rows and columns the multidimensional array has. The succeeding lines contain the values inside the multidimensional array, depending on the number of rows and columns. 5 5 2 5 1 2 3 4 2 1 3 4 8 2 1 9 5 7 0 1 3 4 2 2 1 2 2 Output A single line containing a string "yes" if there is, and "no" if there isn't yesarrow_forwardA unimodal array is an array that has a sequence of monotonically increasing integers followed by a sequence of monotonically decreasing integers, assuming all elements in the array are unique. Example: - A= {4, 5, 8, 9, 10, 11, 7, 3, 2, 1}: A is a unimodal array because there is an increasing sequence followed by a decreasing sequence and the maximum element is 11.- B= {11, 9, 8, 7, 5, 4, 3, 2, 1}: B is not a unimodal array because there is no increasing sequence It is simply a decreasing sequence and the maximum element is 11.- C= {1, 2, 3, 4, 5, 7, 8, 9, 11}: C is not a unimodal array because There is an increasing sequence, but there is no decreasing sequence and the maximum element is 11.a) Design an efficient algorithm with the lowest possible complexity to state whether a given array is unimodal or not, and explain why your algorithm is efficient. b) Analyze the complexity of your algorithm. Data Structure With Pythonarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License