Indicate if each of the following array definitions is valid or invalid. (If a definition is invalid, explain why.)
A) int numbers[10] = {0, 0, 1, 0 , 0, 1, 0, 0 , 1, 1};
B) int matrix[5] = {1, 2, 3 , 4 , 5 , 6 , 7};
C) double radii [10] = {3.2 , 4.7};
D) int table[?] = {2, , , 27, , 45, 39};
E) char codes[]={ 'A','X','1',' 2 ','s'};
F) int blanks[];
G) string suit[4] = {"Clubs", "Diamonds", "Hearts", "Spades"};
Learn your wayIncludes step-by-step video
Chapter 8 Solutions
STARTING OUT WITH C++ MPL
Additional Engineering Textbook Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Digital Fundamentals (11th Edition)
Starting Out With Visual Basic (8th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Problem Solving with C++ (9th Edition)
Starting out with Visual C# (4th Edition)
- (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_forwardsolition in C++arrow_forwardProgramming language: Processing from Java Question attached as photo Topic: Use of Patial- Full Arraysarrow_forward
- Two dimension array in C:Create a two dimension array of integers that is 5 rows x 10 columns.Populate each element in the first 2 rows (using for loops) with the value 5.Populate each element of the last three rows (using for loops) with the value 7.Write code (using for loops) to sum all the elements of the first three columns and output thesum to the screen. without using #definearrow_forwardC programming Input code in "Enter code here" sectionarrow_forwardJava Objective:Design and implement simple matrix manipulation techniques.Details:Your java program should use 2D arrays to implement simple matrix operations.Your program should do the following:• Read the number of rows and columns of a matrix M1 from the user. Use an input validation loop to make sure the values are greater than 0. • Read the elements of M1 in row major order• Print M1 to the console; make sure you format as a matirx• Repeat the previous steps for a second matrix M2• Create a matrix M3 that is the transpose of M1 and print it to the console• Check if M1 and M2 can be added (should have the same dimensions). If possible, add M1 and M2 and print the result to the console. Otherwise print an error message.• Multiply M1 and M2 if possible and print to the console. If the matrices cannot be multiplied, print an error message. Implementation requirements:• Use a helper method for reading a positive integer using an input validation loop.• Use a helper method for printing…arrow_forward
- Look at the following array definition. int values[10];A) How many elements does the array have?B) What is the subscript of the first element in the array?C) What is the subscript of the last element in the array?D) If an int uses four bytes of memory, how much memory does the array use?arrow_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_forwardLook at the following array definition.i nt values [1 OJ;A) How many elements does the array have?B) What is the subscript of the first element in the array?C) What is the subscript of the last element in the array?D) If an int uses four bytes of memory, how much memory does the array use?arrow_forward
- Look at the following array definition: int values[10]; How many elements does the array have? What is the subscript of the first element in the array? What is the subscript of the last element in the array? Assuming that an int uses 4 bytes of memory, how much memory does the array use?arrow_forwardGiven the declaration: int matrix[7][5]; a) How many elements does matrix have? b) Write the statement to read an integer entered at the keyboard into the second row and second column of the array matrix. c) Assume that the array matrix has already been assigned values. Write a statement that outputs the number stored in the first column of the last row in the array matrix. d) Assume that the array matrix has already been assigned values. Write a for loop to calculate the total of the integers stored in the first row of matrix.arrow_forwardMatrix Multiplication• Write a multiplication function that accepts two 2D numpy arrays,and returns the product of the two. This function should test that thearrays are compatible (recall that the number of columns in the firstmatrix must equal the number of rows in the second matrix). Thisfunction should test the array sizes before attempting themultiplication. If the arrays are not compatible, the function shouldreturn -1. solve in pythonarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning