Question: 1. Please write the following programs in c++. Please show all outputs. 1. The arrays list1 and list2 each hold 100 integer elements. Write code

1. Please write the following programs in c++. Please show all outputs.

1. The arrays list1 and list2 each hold 100 integer elements. Write code that copies the values in list1 to list2. 2. The array numberList can hold 25 integer elements. Write 4 functions to return the index (subscript) of the largest element, the index of the smallest element, the sum and the average of numberList. The numberList definition and 4 function headers are as follows: const int SIZE=25; int numberList[SIZE]={0}; int getLargestIdx(int aList[]) int getSmallestIdx(int aList[]) int calcSum(int aList[]) double calcAverage(int aList[]) 3. Write a program to do the followings: a. Save ASCII code 65-90 (upper case A-Z) in an array of characters named alpha with 26 letters. After fillAlpha() function, the array alpha contains: {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z} b. Call the reverseAlpha() function to reverse the order of the letters in the array alpha. After reverseAlpha() function, the array alpha contains: {Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A} c. Print the array alpha before and after the reversal. The three function prototypes are as follows: 1. void fillAlpha(char [ ] ); 2. void printAlpha(char [ ] ); 3. void reverseAlpha(char [ ]) To reverse two letters use the swap technique: char a , b, temp; temp=a; a=b; b=temp: The partial code is listed below: /* * Reverse the contents of an array */ #include using namespace std; const int SIZE = 26; //function prototypes void fillAlpha(char[]); void printAlpha(char[]); void reverseAlpha(char[]); int main() { //variable declarations char alpha[SIZE]; fillAlpha(alpha); cout << " Print Original List:" << endl; printAlpha(alpha); reverseAlpha(alpha); cout << " Print Reversed List:" << endl; printAlpha(alpha); system("pause"); return 0; } //function definitions void fillAlpha(char letters[]) { for (int i = 0; i < SIZE; i++) { letters[i] = static_cast(65 + i); } } void printAlpha(char letters[]) { for (int i = 0; i < SIZE; i++) cout << letters[i] <<" "; cout << endl; } void reverseAlpha(char letters[]) { //your code here }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!