but working in microsoft studio
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
ofstream outfile;
string filename;
char ans;
int cnt=0;
do{
cnt++;
cout << "Please enter filename: ";
cin >> filename;
outfile.open(filename);
outfile.close();
cout << "Do you wish to add file? yes(y)/no(n): ";
cin >> ans;
}while(ans!='n'&& cnt<=100);
system("pause");
return 0;
}
I WONDER?!
Nothing wrong with that code. I would just chalk it up to Dev C++ sucking. (edit: Vlad spotted what might be the error)
Also, "not working" doesn't tell us anything. That could mean any number of things. Please be more specific.
Last edited on
I do not know what does not work but I can advice to include header <cstdlib>
Ah! yeah good catch. <cstdlib> has the system definition. Good eye, vlad.