0

I'm trying to take a text file like:

22.5 34.60 48.1 
53.2 66.1 22.4
33.0 44.1 86.2

and have the program recognize that there are three columns and sort them into an array for each column.

float number;
//float number[3];

ifstream input_file(m_inputFile);
if (!input_file.is_open()) {
    cerr << "Unable to open file " << m_inputFile << endl;
}

//int columns = defineColumns();

while (input_file >> number) {
    cout << number << ";";
}

input_file.close();

I think right now I'm nowhere near close to figuring out how to check for /n with ifstream and am just printing it to console. Any suggestions for doing this are very much appreciated.

0 Answers0