Here I have functions that initializes first 25 elements by squaring the index and the other 25 by multiplying 3 times the index. My assignment has instructed me to print out 10 elements per array. How possibly can I print out 10 numbers per line?????
//Function to initlizae an array. First 25 components is equal to the square of the index
void twentyfivecompinitial(double alpha[],int size)
{
int index=0;
for (index=0;index<size/2;index++)
{
alpha[index]=(index*index);
cout<<" ";
cout<<alpha[index];
}
while (index<size)
{
alpha[index]=(3*index);
cout<< " ";
cout<<alpha[index];
index++;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
//Declare an array aplha of 50 compnents of type double
double aplha[50];
//Function call to intialize first twenty five from the square of index variable
twentyfivecompinitial(aplha,50);
_getch();