#include <iostream>
#include <time.h>
usingnamespace std;
int main()
{
constint num = 10;
int ran[num], high =0, high2, low = 16;
srand(time(NULL)); //code to generate random numbers
for (int i = 0;i < num;i++)
{
ran[i] = rand()%15+1; //the maximum number that will be generated is 15
}
for (int i = 0; i < num;i++)
{
cout<<ran[i]<<' ';
}
for (int count=0; count < num; count++ )
{
if (ran[count] > high)
{
high2 = high;
high = ran [count];
}
elseif (ran[count] > high2)
high2 = ran[count];
if (ran[count] < low)
{
low = ran[count];
}
}
cout<<endl;
cout<<"The highest number is "<<high<<endl;
cout<<"The second highest number is "<<high2<<endl;
cout<<"The lowest number is "<<low<<endl;
system ("pause > 0");
return 0;
}
the second highest number displays the duplicate of the highest if ever there is one.