I’m starting to write C++ and I’m trying to read a text file that is formatted like this:
32.0 12.43
503.2 3.212
etc.
In Java, I could use a Scanner with .nextFloat(), and put the contains into an Array. I am trying to achieve the same thing with C++. How is this done?
To read from standard input
To read from a file
To read all floats into an array (vector) of floats, you can use this:
Read more about stream input/output here and elsewhere.
I would also strongly advise that you read a good C++ book