I am new in c++. I need to read a text file containing something like this data: 0.6662 0.5435 0.5545 0.55487 0.4346 0.7698 0.8965 0.56438 ... ... It is 100 rows and 4 columns I write the following codes: #include #include #include using namespace std; //The main program int main() { double str[100][4]; string xx; ifstream myfile("testfile.txt"); while(!myfile.eof()){ getline(myfile, xx, ' '); for (int i = 0; i < 100; i++){ for (int j = 0; j < 4; j++){ str[j] = atof(xx.c_str()); } } } myfile.close(); system("pause"); } I checked the matrix str, it just give me first column repeatedly. I am no where close to the answer. Please help...