text to array HELP!!!!!

ok, im supposed to import a .txt file... it has a 20x20 grid with random numbers like so

01 23 21..... -> 20 numbers by 20 numbers
34 41 21.....

and fill up an array with those numbers

to calculate some additions ive got everything exept for the part where i fill up my array


#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <cstdlib>


using namespace std;

int main() {

// Open file
ifstream myfile("test.txt",ios::in);

// test if file is read
if (!myfile)
{
//display something if file not read
cerr << "File not Read"<< endl; // !Working
exit( 1 );
}
for (int i = 0; i < 20; ++i)
{
for (int j = 0; j < 20; ++j){
myfile >> array[i][j];


}
cout << endl;
}

myfile.close();
}

but this is not working for some reason... its not loading my array
You have not declared your array.
its declared! i just didn include it here
Well I told you what was wrong with the code that you posted. If you want to know what's wrong with the code that is causing a problem then you need to post that instead. ;o)
Topic archived. No new replies allowed.