Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a three function program (your main function and two other functions). The

ID: 3547668 • Letter: W

Question

Write a three function program (your main function and two other functions).

The main function of the program should create an array that can store 10 integers.

The main function will then pass the array to a second function that gets the integers from the user and stores them in the array.

Then your main will call a third function that displays the elements in the array in the reverse order.

You must not use global variables.

Pass the array and the number of elements in the array as arguments to both of the called functions.

Here is some sample output:

Enter number 1: 12[Enter]

Enter number 2: 15[Enter]

Enter number 3: 4[Enter]

Enter number 4: 65[Enter]

Enter number 5: 42[Enter]

Enter number 6: 19[Enter]

Enter number 7: 5[Enter]

Enter number 8: 7[Enter]

Enter number 9: 33[Enter]

Enter number 10: 87[Enter]

Explanation / Answer

#include<iostream>
using namespace std;
int main(){
int arr[10]; int n = 10; readElements(arr,n); printElements(arr,n);
rfeturn 0; }
void readElements(int arr[] , int n){ int i=0;
for(i=0;i<n;i++){    cout << "Enter number " + i + ":" ; cin >> arr[i] ; cout <<endl;    }

}
void printElements(int arr[] , int n){ int i=0;
for(i=0;i<n;i++){    cout << "Value number " + i + " is " ; cout << arr[i] ; cout <<endl;    }

} void printElements(int arr[] , int n){ int i=0;
for(i=0;i<n;i++){    cout << "Value number " + i + " is " ; cout << arr[i] ; cout <<endl;    }

}
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote