Hi everyone!
I need this: the user can choose the name of the output file, however, if the file can not be open, the program will automatically use cout. I donīt want to do this with if, because there are many regions in the program that use this output file, the code will become dirty if I use if
A sample high-level algorithm would be:
Thanks any help!Code:out_file.open(user_file); if(!out_file){ out_file = cout; } //use out_file at will