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)
- Define the following arrays: A) empNum, a 100-element array of intsB) payRate, a 25-element array of doublesC) miles, a 14-element array of longsD) stateCapital, a 50-element array of string objects.E) lightYears, a 1,000-element array of doublesarrow_forward1. Define an array called grades with type char and size 10 2. Write a for loop to initialize the above array with value 'A' 3. Write a nested for loop to print out a 2d array in a table format. The name of the array is called values, 5 rows and 10 columnsarrow_forwardAn array is a data structure that contains a group of element. Typically these elements are all of the same data type such as an integer or string. (a) Write the code to perform the following tasks: i. Declare an array mark of 5 components of type int. ii. Initialize array mark to the following values: 19, 19, 8, 17, 9 iii. Take input from the user and insert in second element. iv. Print the adding value of third element and fourth element. v. Print sum value of all elements. vi. Print the lowest value. ANSWER NEEDED IN C++arrow_forward
- 8 data array WORD 5 DUP(4 DUP(10)) what is the value of the following operators: out of TYPE array, LENGTHOF array. SIZEOF array question O a 2, 20, 40 O b. 4, 20, 80 Oc 2, 50, 100 O d. 1, 20. 20arrow_forwardAn array is a data structure that contains a group of element. Typically these elements are all of the same data type such as an integer or string. (a) Write the code to perform the following tasks: i. Declare an array mark of 5 components of type int. ii. Initialize array mark to the following values: 19, 19, 8, 17, 9 iii. Take input from the user and insert in second element. iv. Print the adding value of third element and fourth element. v. Print sum value of all elements. vi. Print the lowest value.arrow_forward/* * AHPA #8: The C ATM Machine * * Two people, "a" and "b", have checking and savings accounts. * * Create a 2x2 array to hold their amounts: a – checking: $500, savings: * $1,000; b – checking: $750, savings: $325. * * Have the ATM machine ask the user their name. * * Ask the user if they want to withdraw from their checking or their * savings account. * * Use a switch statement to process different types of accounts. * * Create software that will provide an ATM user with the proper change * for any dollar amount up to $200. ( C PROGRAMMING LANGUAGE) * * Example: Run the code for $19, $55, and $200. * */ #include <stdio.h>#include <stdlib.h>#include <stdbool.h>#include <string.h>#include <time.h> int main(void) { return 0;} (PLEASE WITH COMMENT AND OUTPUT SHOULD BE SHOWN IN PICTURE BELOW)arrow_forward
- Code for this in C: You have already created an array named NUMBERS with 20cells. You are to initialize all of the cells with odd subscripts to 1 and all of the cells with even subscripts to 2.arrow_forwardAssume that the integer array myScores has been declared and assigned values. Assume that the integer variable size has been declared and initialized using the number of elements in the array myScores. Write a code block that declares a pointer to an integer and initializes it using the address of the array. Use that pointer to access the array elements, compute their average (as double), and display it on the screen.arrow_forwardd) Print all the elements of the array that are greater than the previous element at smaller than the next element. The first and the last element should be excluded. int arr[] = {5,14,66,7,22,39,0,-12,23,91}arrow_forward
- 4. Array code Fill in the method below to have it create and fill in an array of 4 doubles. The first ele- ment should be set to the average of the first quarter of the array passed to data, the second element should be set to the average of the second quarter of the array, and so on. If input data is [1, 2, 3, 4, 5, 6, 7, 8] result should be [1.5, 3.5, 5.5, 7.5] public static double[] quartileAverages(int [] data) {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_forwardC 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_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,