Hi!
So the purpose of my program is to prompt the user for an input file which contains on column of values and stores them in an array.
Once stored in the array another function will find the minimum value in the array and print it. Two similar functions will find the max average and standard deviation on the array.
The
Problem I am having is that I cant figure out how to pass the array from the function it is created in and the one that finds the minimum value.
The book I am using shows how to pass reference variables between functions but nothing about arrays. The example the course instructor has online
http://www2.cs.uidaho.edu/~bruceb/cs112/Code/arrays.cpp has done nothing but confuse me.
can someone point me in the right direction so I can begin to understand prototypes?
Code:
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int iofile();
{ char file [25];
cout <<" enter a file name" <<endl;
cin >> file;
ifstream in_file(file, ios::in );
if(!in_file.is_open())
{cout <<"File Error"<< endl;
return 1;
}
double array[92];
for (int i=0; i<92; i++)
{
in_file >> array[i];
}
return array[92];
}
int minval()
{ double min = array[0];
for( int n = 0; n < 92; n++ )
{
if( array[n] < min )
min = array[n];
}
cout << min << " " << array[91]<<endl;
}
int main()
{
iofile();
minval();
}