I have a problem reading file by using c++.The file which contains a float number at every line as following
1.33
5.45
6.21
2.48
3.84
7.96
8.14
4.36
2.24
9.45
My code is reading and printing everyline and printing it two times.How can i fix it?
string line;
fstream inputNumbersFile("input.txt");
if (inputNumbersFile.is_open())
{
while (!inputNumbersFile.eof())
{
getline(inputNumbersFile, line);
cout << line << endl;
}
}