I have this problem:
Code:
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
string s;
cout<<"Enter file name: ";
getline(cin,s);
ofstream File(s.c_str());
if(!File)
{
cout<<"Error openning file!"<<endl;
return 1;
}
for(;;)
{
cout<<"Enter new sentence: ";
getline(cin,s);
File<<s;
File<<'\n';
cout<<"Enter 0 for exit or something else to continue: ";
getline(cin,s);
if(s=="0")
break;
cin.clear();
cin.ignore(1000);
}
return 0;
}
but his won't stop. How can I fix it?