#include <fstream>
#include <vector>
constexpr int COLUMNS_AMOUNT = 10; //amount of columns in the textfile
int main(int argc, char** argv)
{
std::ifstream file_stream("jy.txt"); //create filestream to file
std::vector<std::vector<int>>* matrix; //pointer to multidimensional vector
matrix = new std::vector<std::vector<int>>(); //allocate new vector on the heap
int index=0, tmp;
while (file_stream.good()) //while data in the filestream
{
for (int i=0; i<COLUMNS_AMOUNT; i++) //for every row
{
if (file_stream.eof()) //check for end of file
break;
file_stream >> tmp; //fetch the next value
(*matrix)[index][i] = tmp; //store the next value
}
++index; //increment row-index
}
//do whatever you want with the matrix
file_stream.close();
delete matrix;
return 0;
}
I2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDx2ZWN0b3I+Cgpjb25zdGV4cHIgaW50IENPTFVNTlNfQU1PVU5UID0gMTA7IC8vYW1vdW50IG9mIGNvbHVtbnMgaW4gdGhlIHRleHRmaWxlCgppbnQgbWFpbihpbnQgYXJnYywgY2hhcioqIGFyZ3YpCnsKICAgIHN0ZDo6aWZzdHJlYW0gZmlsZV9zdHJlYW0oImp5LnR4dCIpOyAvL2NyZWF0ZSBmaWxlc3RyZWFtIHRvIGZpbGUKCiAgICBzdGQ6OnZlY3RvcjxzdGQ6OnZlY3RvcjxpbnQ+PiogbWF0cml4OyAvL3BvaW50ZXIgdG8gbXVsdGlkaW1lbnNpb25hbCB2ZWN0b3IKICAgIG1hdHJpeCA9IG5ldyBzdGQ6OnZlY3RvcjxzdGQ6OnZlY3RvcjxpbnQ+PigpOyAvL2FsbG9jYXRlIG5ldyB2ZWN0b3Igb24gdGhlIGhlYXAKCiAgICBpbnQgaW5kZXg9MCwgdG1wOwoKICAgIHdoaWxlIChmaWxlX3N0cmVhbS5nb29kKCkpIC8vd2hpbGUgZGF0YSBpbiB0aGUgZmlsZXN0cmVhbQogICAgewogICAgICAgIGZvciAoaW50IGk9MDsgaTxDT0xVTU5TX0FNT1VOVDsgaSsrKSAvL2ZvciBldmVyeSByb3cKICAgICAgICB7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