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
Expert Solution & Answer
Chapter 7, Problem 1RQE
Explanation of Solution
Difference between size declarator and subscript of an array:
Size declarator of an array | Subscript of an array |
An array size declarator describes the number of elements that the array contains. | An array subscript specifies the position of the element to get access from the array. |
For example:
/*Declaring the size of the array*/ int array1= 10 |
For example: /*Declaring the subscript of the array*/ int a[]= 10; int a[0]=3; |
From the above example, the array variable “array1” contains 10 elements in it. | From the above example, the array “a[]” contains ten elements in it. The subscript of the array “a[0]”, that is, the first position of array “a[]” is assigned with the value “3”. |
Want to see more full solutions like this?
Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
in c++ code
Name the family of methods in the .NET Framework that can be used to convert a string to any of the numeric data types.
The members of a structure (inside structure body) are separated by
Select one:
O a. braces
O b. colons
O C. semicolons
O d. commas
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
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
- b) What is the difference between StringBuilder and String?arrow_forwardI want to find the Substrings from the string. The indexes are 5 16 7 10 and 2 to 10 And print all the Substrings in clojure programming language You can assume the string as you want.arrow_forwardThe Form class has ____________ properties. a. three b. ten c. about 100 d. about 1000arrow_forward
- Using C++ Language Use cout statements to display a 3-dimensional figure of the cube (consider using the characters “-\|/_”) when the program starts up to show the numbering of the corners. The cube corners are labeled from 0 to 7 with 0 starting at the upper left-hand corner of the front face of the cube proceeding clockwise with corners 0, 1, 2, and 3 on the front face, and corner 4 being the upper left-hand corner of the rear face and proceeding clockwise with corners 4, 5, 6, and 7 on the rear face. (Note that computer scientists generally start counting at zero, rather than one, as the math calculations work out better. This will make more sense once we study 2 dimensional arrays.) You will need a delay function to slow down your code so the user can see Herman moving around the cube. You might want to get the following code working in a separate test project and then figure out how to use it in your Herman solution (see below) For each simulation, use cout statements to display…arrow_forwardSolve it using c++ visual studio 2022 please. Thank youarrow_forwardProject 3: You have to create a program in C language in which the user enters the mass M and radius R of a ring and the program should display the moment of inertia of the ring about an axis perpendicular to the plane of the rod and passing through the center.arrow_forward
- Identify errors/mistakes from the following PHP code segment. Rewrite the code segment with a correct syntax and highlight the changes that have been corrected. $$num == 22 % 2; if ($num = 2 || $num = 3 || $num = 4) { echo "This is not the number"+" you're looking for"; } else if ($num = 5) { echo "A snack is on its way to you!"; } else echo "Ahaaaa Yes!";arrow_forwardHow is a String different from a basic data type (such an int, double, or boolean)?arrow_forwardAssignment Name JavaScript Concepts III Assignment Filename lastname-circleArea.html (replace lastname with your last name). area.js Assignment Description This assignment demonstrates the following concepts: JavaScript Functions Assignment Instructions Write a JavaScript program that calculates the area of a circle: Write a function that calculates the area of a circle given the radius. Formula: Math.PI * (radius * radius) Your program code should contain appropriately named variables. Use documentation to identify various components of your program. Call the function once and pass a radius value of 10.75 to it. Use the starter files and complete the logic to satisfy the instructions. To access the files, download and save the circleArea.zip folder attached to this assignment. Then unzip the compressed folder to reveal the included files: circleArea.html and area.js. Be sure that the two files are in the same folder. Then write your code in the area.js…arrow_forward
- on c++arrow_forwardJavascript Programming <script>function getCardType() {var cNum1 = document.getElementById("ccNum1").value;var cardname = "";if (cNum1 != "") {if (cNum1.startsWith("4")) {cardname = "Visa";} else if (cNum1.startsWith("5")) {cardname = "MasterCard";} else if (cNum1.startsWith("6")) {cardname = "Discover";} else if (cNum1.startsWith("3")) {cardname = "American Express";}}document.getElementById("cardType").innerHTML = cardname;}</script></body>arrow_forwardPlease help with this code and make sure to create in c++. Make sure it is 100% correct and works on Visual studios. Thxs. Write the code as described in the questions below. Submit your code electronically in the box at the bottom. You may only use Java, C# or C++. The economy is defined using a 2-dimensional data structure: A “payday” will be considered to be any region of $ values where all cells in the region are connected either vertically or horizontally. For example, the following illustrates a matrix with 5 rows and 8 columns containing three objects. $’s and P are used in the diagram to represent the two types of values: PPPP$PPPPPP$$PPPPP$$PPP$PP$PPPP$P$PPP$$$ a) Write a program to read in the data from the text file and store it into a data structure. Your program should output it to the screen after it has read in the file. (If you can’t get this to work hard-code the above example and continue to part b). Here is a sample text file (containing the above data):…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT