#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;
string textus;
string nazwa;
int main()
{
fstream file;
cout << "Witaj w notatniku !" << endl;
cout << "podaj nazwe pliku : " ;cin>>nazwa;system("cls");
cout << "Twoj tekst pisz tutaj :" << endl;
file.open(/*nazwa pliku przez użytkownika*/"",ios::out|ios::app);
cin>>textus;
file<<textus<<endl;
file.close();
return 0;
}
Za pomocą biblioteki fstream .