Use [co
de][/code] to highlight the code!!!
Some other things:
Don't use
void main ()
, but rather
int main ()
You should use the new headers (iostream, fstream etc) rather than the old ones...
Now to your question:
There are multiple ways to approach it:
As you are using an old compiler (which I assume to be Turbo C++),
you can't use std::string, making things more complex.
Now to the ways, you can create an array of arrays of chars (
char FileName[a][b]
where a and b are constant values...).
This will allow you to hole multiple strings, and you can add an
".txt"
after their name in the
out_file
.
Or you can create a name which will change (by adding another character to the end).
If you have an access to std::string:
Create an array of std::strings, and follow the process I gave for an arrays of arrays of chars.
Or you can change the last character of the string*.
*Reference on std::strings:
http://www.cplusplus.com/reference/string/string/