It would be much easier if you used a std::string in place of the character array then on line 16 all you would have to do is
ofstream fout (name + ".txt");.
From C++11 standards on you can use a std::string for the file name.
You would also have to include "<string>" header file and change line 7 to
Hope that helps,
It works...Thank you very much @thomas1965.
I don't have much information about setting up IDE...
which one is the best standard and IDE?