Ok I have done this and it all works great. But now Im trying to take it a step further start small and add a little at a time yeah sounds good to me lol. Well anyway I need to take the numbers I get from this array and get the mean from them. I have tried numerous possibilites and cant get it to compile. Any suggestions I keep getting warnings converting int to double and things like this. Thanks in advance....
[code=cpp]
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <fstream>
using namespace std;
double the_mean ( int a [ ], int size );
int main ()
{
const int SIZE = 150;
double a [ SIZE ];
double data [SIZE];
double input;
int index = 0;
ifstream fin;
fin.open ("data07.fp100" );
while ( fin >> input )
{
data [ index++ ] = input;
if ( index >= SIZE ) break;
}
fin.close( );
cout << "\n" << index << " fp numbers were read from disk file.";
for ( int i = 0; i < index; ++i )
{
if ( i % 5 == 0 ) cout << "\n";
cout << setw (14) << data [ i ];
}
cout << "\n";
return EXIT_SUCCESS;
}[/code]
[code=cpp]
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <fstream>
using namespace std;
double the_mean ( int a [ ], int size );
int main ()
{
const int SIZE = 150;
double a [ SIZE ];
double data [SIZE];
double input;
int index = 0;
ifstream fin;
fin.open ("data07.fp100" );
while ( fin >> input )
{
data [ index++ ] = input;
if ( index >= SIZE ) break;
}
fin.close( );
cout << "\n" << index << " fp numbers were read from disk file.";
for ( int i = 0; i < index; ++i )
{
if ( i % 5 == 0 ) cout << "\n";
cout << setw (14) << data [ i ];
}
cout << "\n";
return EXIT_SUCCESS;
}[/code]
Comment