Define the following arrays:
A) ages, a 10-element array of ints initialized with the values 5, 7, 9, 14, 15, 17, 18, 19, 21, and 23
B) temps , a 7-element array of doubles initialized with the values 14.7, 16.3,
18.4 3, 21.09, 17.9, 18.76, and 26 .7
C) alpha, an 8-element array of chars initialized with the values ‘J’, ‘B’, ‘L’, ‘A’ “*” ‘$’ ‘H’ and ‘M’
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Starting Out With C++: Early Objects (10th Edition)
Additional Engineering Textbook Solutions
Problem Solving with C++ (9th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Artificial Intelligence: A Modern Approach
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (7th Edition)
Starting Out with Python (3rd 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_forwardMark the following statements as true or false. A double type is an example of a simple data type. (1) A one-dimensional array is an example of a structured data type. (1) The size of an array is determined at compile time. (1,6) Given the declaration: int list[10]; the statement: list[5] - list[3] * list[2]; updates the content of the fifth component of the array list. (2) If an array index goes out of bounds, the program always terminates in an error. (3) The only aggregate operations allowable on int arrays are the increment and decrement operations. (5) Arrays can be passed as parameters to a function either by value or by reference. (6) A function can return a value of type array. (6) In C++, some aggregate operations are allowed for strings. (11,12,13) The declaration: char name [16] = "John K. Miller"; declares name to be an array of 15 characters because the string "John K. Miller" has only 14 characters. (11) The declaration: char str = "Sunny Day"; declares str to be a string of an unspecified length. (11) As parameters, two-dimensional arrays are passed either by value or by reference. (15,16)arrow_forwardUse Array instead of vectors- Implement following classes and required member functions in C++ OOP style. A main function Introduce Movie object first. Then add several Movie objects along with necessary data ( Date, Title, Genre, category etc ) to array of movies. Movie class that has functions to add and delete movies.a. Introduce a searchEvent(by category/title/year etc) which will print out all movies of a specified search. Perform deletion and insertion operations. Introduce sort movies function by year, title and category and display. Introduce private members of your choice and use Setter and/or getter functions extract and modify these data members. Then please make sure you invoke all functions in main function. Fast answer pleasearrow_forward
- Write a code in C++ for inserting the following numbers in the array. (1) Create a Dynamic Array of size 14 using new operator.(2) Insert all numbers in the Array.(3) Print all elements of the Array. 4, 95, 23, 52, 65, 753, 878, 78, 95, 283, 197, 56, 79, 9arrow_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_forward#include <iostream> using namespace std; // define a function // pass a 2d array as a parameter void display(float numbers[][2]) { cout << "Displaying Values: " << endl; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { cout << "num[" << i << "][" << j << "]: " << numbers[i][j] << endl; } } } int main() { // initializing the 2 dimensional array. int actions[3][2] = { {30, 704}, {70.9, 51.7}, {35.7, 11.92} }; return 0; } Modify the “actions array in main” without touching the dimension or initialization to enable it to be used in the display function.arrow_forward
- 1. Program the following.· Prompt the values from user for a single dimensional integer array of length 5 and accept them in FirstIn First Out form.· Consider a one dimensional character array of length 5 and holding data a, e, i, o and u. Sort themin ascending order.· Randomly place values in a 2 dimensional integer array.· Prompt values from user for a one dimensional integer array of length 10 in FILO order. Arrange thisarray in ascending and descending order in other 2 arrays. Language Carrow_forwardC Language: Answer the following 1. Write an appropriate array definition for each of the following problem situations:a. Define a one-dimensional, 12-element integer array called C. Assign the values 1, 4, 7, 10, …, 34 to the array elements.b. Define a one-dimensional character array called point. Assign the string “NORTH” to the array elements. End the string with the null character.c. Define a one-dimensional, four-character array called letters, assign the characters ‘N’, ‘S’, ‘E’, and ‘W’ to the array elements.arrow_forwardCODE IN C++.Write the code to copy values in one array to another. In the following code snippet, we copy values from intArr1 to intArr2. Also, intArr1 will no longer be used and therefore the memory used for intArr1 should be deallocated....int * intArr1 = new int [2];// assign values to intArr1...int * intArr2; // now write the code for allocating space for intArr2, copying values from intArr1 to intArr2, and for deallocating space used by intArr1.arrow_forward
- Write C++ statements to define and initialize the following arrays. a. Array heights of 10 components of type double. Initialize this array to the following values: 5.2, 6.3, 5.8, 4.9, 5.2, 5.7, 6.7, 7.1, 5.10, 6.0.b. Array weights of 7 components of type int. Initialize this array to the following values: 120, 125, 137, 140, 150, 180, 210.c. Array specialSymbols of type char. Initialize this array to the following values: '$', '#', '%', '@', '&', '!', '^'.d. Array seasons of 4 components of type string. Initialize this array to the following values: "fall", "winter", "spring", "summer".arrow_forward1. 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_forwardConsider the following statement.double *sales;a. Write the C11 statement that dynamically creates an array of 50 components of type double and assigns the base address of the array to sales.b. Write a C11 code that inputs data into the array sales from the standard input device.c. Write a C11 code that finds the index of the largest entry in the array sales.d. Write a C11 statement that deallocates the memory space of array to which sales points.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