#include <conio.h>
#include <iostream>
#include <iomanip>
usingnamespace std;
int main()
{
constint number = 100;
char yes;
int numbers[number];
int n, m = 0, o = 1000, p, q, num; /* m is lowest value in array
o is highest value in array */
srand( (unsigned)time( NULL ) );
do
{
for (n = 0; n < 100; n++)
{
num = rand()% 1000 + 1;
numbers[n] = num;
if (m <= num)
{ m = num;
p = n;
}
if (o >= num)
{ o = num;
q = n;
}
}
for (n = 0; n < 100; n++)
{
cout << "Index # " << n << "\t" << numbers[n] << "\n\n";
}
cout << m << " is the lowest value in the array.\n";
cout << "It is located at array position numbers[" << p << "]\n\n";
cout << o << " is the highest value in the array \n";
cout << "It is located at array position numbers[" << q << "]";
cout << "\n\nWanna run this program again?/n";
cout << "Press Y or y";
cin >> yes;
} while (yes == 'Y') || (yes == 'y');
return 0;
}
#include <conio.h>
#include <iostream>
#include <iomanip>
usingnamespace std;
int main()
{
constint number = 100;
char yes, y, Y;
int numbers[number];
int n, m = 0, o = 1000, p, q, num; /* m is lowest value in array
o is highest value in array */
srand( (unsigned)time( NULL ) );
yes = 'Y';
while (yes == 'Y' || yes == 'y')
{
for (n = 0; n < 100; n++)
{
num = rand()% 1000 + 1;
numbers[n] = num;
if (m <= num)
{ m = num;
p = n;
}
if (o >= num)
{ o = num;
q = n;
}
}
for (n = 0; n < 100; n++)
{
cout << "Index # " << n << "\t" << numbers[n] << "\n\n";
}
cout << m << " is the lowest value in the array.\n";
cout << "It is located at array position [" << p << "]\n\n";
cout << o << " is the highest value in the array \n";
cout << "It is located at array position [" << q << "]";
cout << "\n\nWanna run this program again?\n";
cout << "Press Y or y : ";
cin >> yes;
}
return 0;
}