I would create a string holding the first part of the filename ("output"), read user input, then append() that onto the string. After that, append() your extension then use c_str() as to get the C-style string for the filename.
1 2 3 4 5
string str("output");
// get input
str.append(the_input); // assuming their input is a string or char*
str.append(my_extension);
myfile.open(str.c_str(), /*...*/);