myFirstfile.txt has 4 numbers 4 5 6 7. I am not getting any output. Instead I am getting blinking cursor. I want the numbers from file as output. Please help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<iostream>
#include<iomanip>
#include<fstream>
usingnamespace std;
int main()
{
int x, neg=0, pos =0,sum=0;
ifstream myfile;
myfile.open("firstFile.txt");
while (! myfile.eof() )
{
myfile>>x;
cout<<x<<endl;
}
myfile.close();
return 0;
}