I need to input four variables into a C++ program (Win32) from a text file. Each of the variables are on their own line.
example.txt:
2.651127
-7.802776
5.530998
-17.239931
These four variables will each be a float in my program. What is the syntax in C++ to pass each line to its own variable? There are only ever four numbers, each on their own line.
1 Answer