you handle data entry into an array the same way, whether the data comes from user input, programmer input, or a file. Here's one approach for a 2D array of ints.
Code:
//declare variables
const int FIRST = 5;
const int SECOND = 5;
int myArray[FIRST][SECOND];
int x, y, z;
//will use x and y to locate where to put input
x = 3;
y = 2;
//will use file input
//associate file with stream
ifstream fin("test.txt");
//make sure file opened
if(!fin)
{
cerr << "failed to open file" << endl;
exit(0);
}
else
{
//read in first item in file, if not empty
if(fin >> z)
//assign z to location in myArray
myArray[x][y] = z;
}
There are several other factors you will probably want to take into account, such as: reading more than one item from file into the array in a sequential fashion, making sure you are not overwriting the bounds of the array, etc.