#include <iostream>
#include <fstream>
#include <string>
using namespace std;
// this program contains an error
int main()
{
ifstream ifs("data.txt") ;
string name;
cout<<"enter the names:"<<endl;
for(int i=0;i<6;i++)
{
cin>>name;
}
// error in stream test
while(!ifs.eof( ))
{
cout<<name<< endl;
}
system ("pause");
return 0;
}
#include <fstream>
#include <string>
using namespace std;
// this program contains an error
int main()
{
ifstream ifs("data.txt") ;
string name;
cout<<"enter the names:"<<endl;
for(int i=0;i<6;i++)
{
cin>>name;
}
// error in stream test
while(!ifs.eof( ))
{
cout<<name<< endl;
}
system ("pause");
return 0;
}
Comment