char NAME[256];
cin.getline (NAME,256);
ofstream fout(\"NAME.txt\"); //NAME???????
What i need to do to create file with NAME name?
You can try this.
#include
#include
#include
using namespace std;
int main()
{
string fileName;
cout << "Give a name to your file: ";
cin >> fileName;
fileName += ".txt"; // important to create .txt file.
ofstream createFile;
createFile.open(fileName.c_str(), ios::app);
createFile << "This will give you a new file with a name that user input." << endl;
return 0;
}