Can anyone tell me why the output of this program is just being "end"? The file naocompre.txt is in the same directory as the program.
Follow the code:
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main ()
{
string info;
ifstream input("naocompre.txt");
if(input.is_open()) {
while(!input.eof()) {
string info;
getline(input,info);
cout<<info<<endl;
}
}
cout<<"end"<<"\n";
return 0;
}
Content from naocompre.txt:
NaoCompre Costeira
5
7
4
Maria_Benta 1 800
Juliana_Digito 1 800
Zeca_Mole 3 180
Joao_DeMora 3 180