write a statement to do the following
1 change 19 to 108
2 display the array on reverse
3 find the min and max value and display
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
int main()
{
srand(time(0));
int A[108];
for (int i = 0; i < 108; i++)
{
A[i] = rand() % 5000;
}
cout << "Array in right order: ";
for (int i = 0; i < 108; i++)
{
cout << A[i] << " ";
}
cout << endl << endl << "Array in reverse order: ";
for (int i = 107; i >= 0; i--)
{
cout << A[i] << " ";
}
int min = A[0];
int max = A[0];
for (int i = 1; i < 108; i++)
{
if (A[i] > max) max = A[i];
if (A[i] < min) min = A[i];
}
cout << endl << endl;
cout << "Max value is: " << max << endl;
cout << "Min value is: " << min << endl;
system("pause");
return 0;
}
Comments
Leave a comment