Well.. you could use redirection.
Write your program to use cout and cin(or printf and scanf..) for I/O ..and then.. when running; use the command.


./executable <input_file >output_file

...