Exercises 7.6(Fill in the Blanks) Fill in the blanks in each of the following:
a) The names of the four elements of array p are ____, ____, ____ and ____.
b) Naming an array, stating its type and specifying the number of elements in the array is called ____ the array.
c) When accessing an array element, by convention, the first subscript in a two-dimensional array identifies an element's ____ and the second subscript identifies an element's ____.
d) An m-by-n array contains ____ rows, ____ columns and ____ elements.
e) The name of the element in row 3 and column 5 of array d is ____.
Fill in the blanks for the given statements related to arrays.
Explanation of Solution
- Given statement: The names of the four elements of array p are p[0], p [1], p[2] and p[3].
- Naming an array, stating its type and specifying the number of elements in the array is called declaring the array.
- When accessing an array element, by convention, the first subscript in a two-dimensional array identifies an element’s row number , and the second subscript identifies an elements’ column number.
- An m-by-n array contains m rows, n columns and m*n elements.
- The name of the element in row 3 and column 5 of array d is d[3][5].
To refer to any single element of the array are, you need to specify the name of the array and its position. Positions of elements of a n-size array are indexed from n = 0 till n − 1. So four elements of array p will be p[0], p[1], p[2], and p[3].
Declaration of array involved specifying the name of the array, along with its size and type. For example,
double p[10]; //declaration
This means an array of size 10, name p & type double has been declared.
An array comprises of rows & columns. The first subscript is row & second is column number. For example,
double p[9][10]- means element in the 9th row & 10th Column
The size of an array is given as the product of its row & columns. Example, for array a[10][2]- the total number of elements will be 10*2=20 and it will have 10 rows and 12 columns.
Name of element includes row & column number- with row number followed by column number.
Want to see more full solutions like this?
Chapter 7 Solutions
C++ How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (10th Edition)
- C++arrow_forward(Statistics) a. Write a C++ program that reads a list of double-precision grades from the keyboard into an array named grade. The grades are to be counted as they’re read, and entry is to be terminated when a negative value has been entered. After all grades have been input, your program should find and display the sum and average of the grades. The grades should then be listed with an asterisk (*) placed in front of each grade that’s below the average. b. Extend the program written for Exercise 1a to display each grade and its letter equivalent, using the following scale: Between90and100=AGreaterthanorequalto80andlessthan90=BGreaterthanorequalto70andlessthan80=CGreaterthanorequalto60andlessthan70=DLessthan60=Farrow_forwardNonearrow_forward
- Q1) write a program to find the summation of 10 elemnets array. if the sum even, creas the array (set all element to zero) otherwise do nothing.arrow_forwardQ.5) Part A Write a program in C++ language to print the number of elements that are divided by 5 without the remainder for one-dimensional array B on the screen, which has ten elements entering from the keyboard.arrow_forwardEXERCISE 27 Writing a function that calculates the occurrence of an integer A in an integer array T of size N. EXERCISE 28 Tis an array of N integers. N is defined as a constant equal to 10. Write a procedure proc1(int *T) that reads the N elements of the array by checking that the entered values are between 10 and 20. This procedure will display thereafter the N values of the array, the sum value, the maximum value and the minimum value of elements in this array.arrow_forward
- Q1) Write a program to read the values of an array 4*9 , and then find the summation of the negative odd values that can be divided by 13.arrow_forward3. a) java Declare an double array with 7 elements size and assign the values: 2, 4, 6, 8. b) Display the second and fourth element from an array.arrow_forwardM09.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr