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.24CP
Fill in the table below so that it shows the contents of the following array:
int table[3][4] = {{2, 3}, {7, 9, 2), {1}};
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
int Marks [20] = { 70,85, 60, 55,90,100,50};
For the above code, answer the following questions in the space provided below:
1. Find the size of Marks array.
2. How many number of elements are present in Marks array ?
3. Find the index value for last element in array
4. Find the index value for the element 60
5. Find the value of Marks[2] + Marks[0] in Marks array.
4. Fill in the table below to trace the values of the arrays in main at various points.
int array1 = (10,20,30,40,50)};
int] array2 = (5,4,3,2,1};
intij array3 = new int[5];
Ilprint the array values at this point
dolt(array1, array2);
/print the array values at this point
array2 = array1;
Ilprint the values at this point
array3 = dolt(array1,array2);
Ilprint the array values at this point
} llend of main
public static int] dolt(int] arri, int] arr2){
int] arr3 = new int[5];
for (int i=0; icarr1.length;1++)
arr3[1] = arr1[i]+arr2[arr2.length-1-i);
return arr3;
Values of the arrays below in main before first invocation of dolt
array1
array2
array3
Values of the arrays below in main after first invocation of dolt
array1
array2
array3
Values of the arrays below in main before second invocation of dolt
array1
array2
Values of the arrays below in main after second invocation of dolt
array1
array2
array3
Given the following array declaration: int myArray[10]={1,2,3,4,5,6,7,8,9,10}; How would you reference the 3 in the array?
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 does the phrase garbage in, garbage out mean?
Starting Out with Python (3rd Edition)
Modify the temperature conversion program to print a heading above the table.
C Programming Language
Demonstrate each of the anomaly types with an example.
Modern Database Management (12th Edition)
What are the bits in a binary system?
Digital Fundamentals (11th Edition)
Present Value Suppose you want to deposit a certain amount of money into a savings account and then leave it al...
Starting out with Visual C# (4th Edition)
Suppose you omitted the return statement in the function definition for initializeScreen in Display 5.2. What e...
Problem Solving with C++ (9th 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
- 1. Given the following array declaration: int A [ ][ ]={{13, -23}, {3, 80} ,{91,55} }; Write segment of code that will make the last element equal to 14? Answer: 2. Given the following arrays: int arry1 [ ]= {20, -5, 23, 4}; int arry2[4 ] ; If you write: arry2=arry1, will the two arrays become similar? (explain) Answer: 3. What is the number of rows and number of columns of array A declared in question 1? Answer: 4. Consider the arrays in Question 2. List the elements of arry1[ ] after doing the following code: arry1[1]+=2; Answer: 5. Declare a 2D array with 5 rows and 6 columns?arrow_forward1. Given the following array declaration: int A [3 ][2 ]={{13, -23}, {3, 80} ,{91,55} }; declare a pointer that points to A[2][0]? Answer:arrow_forwardThe below array definition causes an error because the number of elements values (5) is less than the size of the array (6). int n[6] = {32, 27, 64, 18, 14}; Select one: True Falsearrow_forward
- 9. What is the length of the following array: byte[] data = { 12, 34, 9, 0, -62, 88 };arrow_forwardPlease analyze the following array. What is the Value of tempArray[9]? int tempArray[10] {1, 2, 3, 4, 5, 6, 7};arrow_forwardArrays Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print:800 775 790 Note: These activities will test the code with different test values. This activity will perform two tests, both with a 5-element array (int runTimes[5]). See "How to Use zyBooks".Also note: If the submitted code tries to access an invalid array element, such as runTime[9] for a 5-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message. #include <iostream>using namespace std; int main() {const int NUM_ELEMENTS = 5;int runTimes[NUM_ELEMENTS];int i; for (i = 0; i < NUM_ELEMENTS; ++i) {cin >> runTimes[i];} /* Your solution goes here */ return 0;} Please help me with this problem using c++.arrow_forward
- Arrays Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print:800 775 790Note: These activities will test the code with different test values. This activity will perform two tests, both with a 5-element array (int runTimes[5]). See "How to Use zyBooks".Also note: If the submitted code tries to access an invalid array element, such as runTime[9] for a 5-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message. #include <iostream>using namespace std; int main() {const int NUM_ELEMENTS = 5;int runTimes[NUM_ELEMENTS];int i; for (i = 0; i < NUM_ELEMENTS; ++i) {cin >> runTimes[i];} /* Your solution goes here */ return 0;} Please help me with this problem using c++.arrow_forwardwrite only the code required to multiply the number 8 to each array value in the array and print the results on the console Int[][] myArray = {{23, 54, -21}, {11, 35, 42}, {7, 18}}; //write your code herearrow_forwardPrint the elements of the array ‘a’ using the mentioned notations: int a[]={1,2,3,4,5}; int *p; p = a; for (int i = 0; i< 5; i++) { //Subscript notation with name of array //Subscript notation with pointer 'p' //Offset notation using array name //Offset notation using pointer 'p' }arrow_forward
- Look at the following array definition.int numberArray[9][11];Write a statement that assigns 145 to the first column of the first row of this array.Write a statement that assigns 18 to the last column of the last row of this array.arrow_forwardd) Print all the elements of the array that are greater than the previous element at smaller than the next element. The first and the last element should be excluded. int arr[] = {5,14,66,7,22,39,0,-12,23,91}arrow_forward23. What are the values of the elements in the array numbers after the following code is executed? int[] numbers = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; for (int i =1, i < 10; 1++) { numbers[i] = numbers [i - 1]; }arrow_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