what I'm trying to do is put make 1 function that declares the array (Which I think I got) and the other function to print the array. The code works perfectly right now how it is but I am trying to practice on how to do them while using functions. Can someone help me out? Thanks
#include <iostream>
usingnamespace std;
//Function Prototypes
void ArrayInt(double&);
void printUser();
int main(){
double alpha[50];
//Call Function
ArrayInt(alpha[50]);
//Start for loop
for ( int i = 0; i < 50; i++ ){
//Start if then statement
//first 25 is the square of the index variable 'i'
if (i < 25){
alpha[i] = i*i;
}
else{
alpha[i] = 3 * i;
}
} //end for loop
//Start for loop
for (int i = 0; i <50; i++){
//Start if then statement
if ( (i+1) % 10 == 0 ){ //10 numbers per line
cout << endl;
} //end if
} //end for loop
system ("pause");
return 0;
}
void arrayInt(double& ){
//Delcare and Initialize Array
double alpha[50];
}
void printUser(){
//Output to user
cout << alpha[i] << " ";
}
Actually the code doesn't work perfectly, I have to erase the void printUser() function for it to work perfectly but I still need help on how to build those functions :)