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++: Early Objects (10th Edition)
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_forwardPROGRAMMING LANGUAGE: C++ Write a program that accepts up to 20 test-match scores of a batsman in the range of 0 to 100 from the user and stores them in an array. Then main should report how many perfect scores (i.e., scores of 100) and ducks (i.e., scores of 0) were enteredarrow_forward
- Java 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_forwardLook 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_forward
- JAVA PROGRAM: Monkey Business 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 × 5 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, or use constant values rather than asking user for input. Then it should create a report that includes the following information: Display 3X5 array first. Average amount of food eaten per day by the whole family of The least amount of food eaten during the week by any one The greatest amount of food eaten during the week by any one Input Validation: Do not accept negative numbers for pounds of food eaten.arrow_forwardComplete the code.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
- 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