1. Your array should contain only elements of the same (or some derived) type.
2. There should be a totally order defined on those type of elements.
3. If your array is of one only dimension searching it for the largest and smallest element in a simple loop shouldn't be as difficult. Or did I misunderstand your question?
Before the loop begins, set both the max and min to the value of the first array element. Use a loop and the < or > operator as appropriate, to test each value, and replace the current max or min as required.
#include <iostream>
usingnamespace std;
int a[10];
int main()
{
while ( a != 10);
{
cout << "Please enter a value for the variable a" << endl;
cin >> a;
}