I need to write a function in devc++ that creates an array of n integers, each element is equal to n*n+i*in*i where i is from 0 to n1 as the array index. Within the same function I need to find the maximum value, minimum value and average of all elements. I'm stuck on the first one :/ I've practiced calling another function to find the maximum, and that seemed to work fine. I get a number in the millions when trying to do this all in one function...can anyone help? Also, shouldn't I be able to do the if statement with the first for loop?
 int array(int n)

{


const int SIZE=n;

int arrayofn[SIZE];


int i, j, max, min;

cout<<"Your array=";

for (i=0; i<=n1; i++)

{

arrayofn[SIZE]=n*n+i*in*i;


cout<<arrayofn[SIZE]<<" ";

}

cout<<"\n";


max=arrayofn[0];

for (j=1; j<SIZE; j++)


{

if (max<arrayofn[j])

max=arrayofn[j];

}

cout<<"The maximum value in the array is: "<<max<<"\n";


}
