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)
- C++arrow_forwardC++ Find 2D array max and min. Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles.Ex: If the input is:-10 20 30 40the output is:Min miles: -10 Max miles: 40 #include <iostream>using namespace std; int main() { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]; int i; int j; int maxMiles = 0; // Assign with first element in milesTracker before loop int minMiles = 0; // Assign with first element in milesTracker before loop int value; for (i = 0; i < NUM_ROWS; i++){ for (j = 0; j < NUM_COLS; j++){ cin >> value; milesTracker[i][j] = value; } } for(i = 0; i <= NUM_ROWS; i++) { for(j = 1; j <= i; j++) { cout << ""; } } cout << "Min miles: " << minMiles << endl; cout << "Max miles: " << maxMiles << endl; return…arrow_forward. Complete the program to processes an array of structured data. Complete those portions indicated in the template. The program has defined a structure named Sale. The structure has the following fields: string itemName int quantity double unitPrice The main function call loadUserlnput which returns a pointer to the first Sale element in the dynamically allocated array of Sale elements and an integer for the number of Sale elements in the array. The main function then calls printData to show the sale items including the total of cach sale item and the total of the entire list. Function printData This is the function you need to complete as well as two other helper functions. In the function body, print the report heading. Then iterate through the array received through the parameters and print the data according to the required format. For the total of each item, call getltemTotal. At the end of the report, print the total of the entire sale items by calling getTotal. Test The Program…arrow_forward
- C Program Functions with 2D Arrays Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space. In the main function, write a program that asks for integer input to be assigned on a 3 x 3 array and call the function displayElements to print the contents on the next line. Input 1. Multiple lines containing integer each line Output R1C1: 1 R1C2: 2 R1C3: 3 R2C1: 4 R2C2: 5 R2C3: 6 R3C1: 7 R3C2: 8 R3C3: 9 1 2 3 4 5 6 7 8 9arrow_forwardWrite a recursive function that returns True if the numerical array passed as input is palindrome, and False otherwise. An array is palidrome if its elements, when flipped, produce an array that is identical to the original one. For example: [1,2,3,2,1] is palindrome [1,2,3,4,3] is not palindrome Fill in the following code skeleton. It is composed of four parts: three base cases and the recursive call. Write code for all the parts. Assume that the input arrays can have any size, and that the elements are always positive integers.arrow_forwardDimensionary Investigation Code in C languagearrow_forward
- Finish the C++ code. Enter the value stored in each element of the given array after the following code executes:arrow_forwardq2 ) In an array A[10], the last element is defined with index ________. a. Undefined b. 9 and 10 c. 10 d. 9arrow_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_forward
- (Electrical eng.) Write a program that declares three one-dimensional arrays named volts, current, and resistance. Each array should be declared in main() and be capable of holding 10 double-precision numbers. The numbers to store in current are 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, and 3.98. The numbers to store in resistance are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, and 4.8. Your program should pass these three arrays to a function named calc_volts(), which should calculate elements in the volts array as the product of the corresponding elements in the current and resistance arrays (for example ,volts[1]=current[1]resistance[1]). After calc_volts() has passed values to the volts array, the values in the array should be displayed from inside main().arrow_forward(Electrical eng.) a. An engineer has constructed a two-dimensional array of real numbers with three rows and five columns. This array currently contains test voltages of an amplifier. Write a C++ program that interactively inputs 15 array values, and then determines the total number of voltages in these ranges: less than 60, greater than or equal to 60 and less than 70, greater than or equal to 70 and less than 80, greater than or equal to 80 and less than 90, and greater than or equal to 90. b. Entering 15 voltages each time the program written for Exercise 7a runs is cumbersome. What method could be used for initializing the array during the testing phase? c. How might the program you wrote for Exercise 7a be modified to include the case of no voltage being present? That is, what voltage could be used to indicate an invalid voltage, and how would your program have to be modified to exclude counting such a voltage?arrow_forward(Program) Write a declaration to store the following values in an array named rates: 12.9, 18.6, 11.4, 13.7, 9.5, 15.2, and 17.6. Include the declaration in a program that displays the values in the array by using pointer notation.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 LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,