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

I need the following program executed in the Visual Logic software: You will cre

ID: 3591868 • Letter: I

Question

I need the following program executed in the Visual Logic software: You will create a program with two methods, the main() method of course and another method called printArray(). The main method will define an array of 5 elements. A loop will be used to prompt the user to enter 5 numeric values which will go into the 5 array elements. The main() method will then call the printArray() method passing the array by reference, and the array length by value. The printArray() method will then print the contents of the array, 0th element first and return.

Explanation / Answer

#include <iostream>

using namespace std;
void printArray(int arr[], int size) {
cout<<"Array elements are: "<<endl;
for(int i=0;i<size;i++) {
cout<<arr[i]<<" ";
}
cout<<endl;
}
int main()
{
int size = 5;
int arr[5];
for(int i=0;i<size;i++) {
cout<<"Enter the number: "<<endl;
cin >> arr[i];
}

printArray(arr, size);
return 0;

}

Output:

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