Y u ppl recommending to hardcore values of minimum and maximum to 0 and let it use as it is for checks?
Think what if minimum value set to 0 and actual minimum value in array is 1 :doh:
your actual code should be like this
#include
using namespace std;
int main ()
{ int const arraysize=10;
int a[arraysize];
int maximum=0;
int minimum=0;
int i;
for ( i= 0 , i > (arraysize) , i++ )
{
cin>>a[i];
if (a[i]>=maximum || i==0)
maximum=a[i];
if(a[i]<=minimum || i==0)
minimum=a[i];
}
cout<<"the maximum of array a is : "<<maximum<<endl;
cout<<"the minimum of array a is : "<<minimum<<endl;
return 0;
}