Loading a data file into a 2-D array

Hi, for a project I have to load a .txt data file into a 2d array and for some reason it keeps outputting the number "20088763392" when I want to display the array that the program just read into

heres the data:

1 78 15 10
2 45 35 67
3 103 75 19
4 30 30 30
5 98 14 47
6 76 57 54
7 110 34 76
8 20 58 14
9 11 76 27
10 60 34 99
11 89 11 76
12 10 36 34
13 27 33 86
14 69 35 45
15 79 74 16
16 12 24 98
17 97 53 54
18 74 12 97
19 36 85 58
20 26 44 46

Here is my code so far:

#include <iostream>
#include <fstream>
#include <cmath>

using namespace std;

//Declaration of Functions

//void scan_batch(int batchdata[20][4]);
//int batchdata[20][4];

//Load data

int main()
{
int batchdata[20][4];
ifstream infile;
infile.open("Batch_Options3.txt");

if (!infile)
{
cout<<"Unable to open file"<<endl;
system("pause");
exit (0);
}
else
cout << batchdata[20][4] << endl;

system("pause");
}
1
2
3
4
5
6
7
double buffer;
for(long i = 0; i < 20; i++)
for(long j = 0; j < 4; j++)
{
    infile >> buffer;
    batchdata[i][j] = buffer;
}


Would that help? hope it compiles, it's from the top of my head. It has to look like that anyway.
Topic archived. No new replies allowed.