The results of this program giving me values that should not be the way it is, it must display the list of numbers...
#include <iostream>
#include <fstream>
using namespace std;
void ReadList(int Array[], int N)
{
ifstream data_file;
data_file.open("numbers.dat");
N=10;
for(int i=0; i<N; i++)
{
data_file >> Array[i];
cout << Array[i];
}
data_file.close();
}
int main ()
{
int numbers[10];
ReadList(numbers, 10);
system("pause");
return 0;
}
numbers.dat: 4 -30 0 7 42 -20 18 400 -123 -6(eof)
but the result is always like this not the list should be..
-858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460
Press any key to continue...