#include #include #include using namespace std; void ReadFromFile(float ary[], int size, ifstream & inFile); void PrintArray(float ary[], int size); void MakeArray(float * & a, int size); float * ArrayMaker(int size); void CopyArrays(float array1[], float array2[],int size); int main() { ifstream inFile; int size; float * array1=NULL; float * array2=NULL; float * array3; inFile.open("data"); inFile >> size; MakeArray(array1, size); ReadFromFile(array1,size,inFile); inFile.close(); cout << "The first array is: " << endl; PrintArray(array1,size); array3 = ArrayMaker(size); CopyArrays(array1, array3,size); cout << "array3 is " << endl; PrintArray(array3,size); cout << endl; /* array2 = array1; cout << "Setting array2 = array1 " << endl; cout << "array2 is " << endl; PrintArray(array2,size); cout << endl; cout << "Setting array 1 to be all 0" << endl; for (int i = 0; i < size;i++) { array1[i] = 0; } cout << endl; cout << "array2 is " << endl; PrintArray(array2,size); */ delete[] array1; delete[] array2; delete[] array3; return 0; } float * ArrayMaker(int size) { return new float [size]; } void MakeArray(float * & a, int size) { a = new float[size]; return; } void ReadFromFile(float ary[], int size, ifstream & inFile){ int i; for(i=0;i> ary[i]; } return ; } void PrintArray(float ary[], int size) { int i; cout << fixed << setprecision(2); for(i=0;i