Following is the working example
#include <iostream>
int main()
{
int numbers[5] = {0,0,0,0,0};
std::cout << "Please Enter a number";
for (int z = 0; z < 5; z++) {
std::cin >> numbers[z];
}
int largestNumber = numbers[0];
int smallestNumber = numbers[0];
for(int i = 1;i < 5; ++i)
{
if ( numbers[i] < smallestNumber )
smallestNumber = numbers[i] ;
if ( numbers[i] > largestNumber )
largestNumber = numbers[i] ;
}
std::cout << "The smallest number is: " << smallestNumber << "\n";
std::cout << "The largets number is: " << largestNumber << "\n";
}
solved Accept 5 numbers from user input and output the largest and smallest