/* J.Y.Kazakia October 14,1998 This example illustrates the following: 1) Arrays in C++. 2) Arrays passed to a function return their updated values to the main. Here a set of four numbers is passed to a function called square_them first individually and then as an array. The results in both cases are then compared. The function forms the squares of the numbers. */ #include #include /* function prototypes */ void square_them ( float a, float b, float c, float d, float array[] ); ofstream out( "6ex3rep.txt" , ios:: out); main ( ) { float a, b, c, d; float array[4]; int i; a = 1.1; b = 2.2; c = 3.3; d = 4.4; for ( i = 0; i <= 3; i++) array [ i ] =(1+ i) +( i +1 ) / 10.; /* this is equivalent to writing: array[0] = 1.1; array[1] = 2.2; array[2] = 3.3; array[3] = 4.4; Print before you call the function */ out << " \n\n\n Printing before calling the function"; out << endl << endl; out << " a =" << a << " b =" << b << " c =" << c <<" d =" << d ; for ( i = 0; i <= 3; i++) out <<"\n\n array["<