Dumb this down
Can someone please dumb down this question for me?
Write the command that would type in on the command line to run the program called Q19.exe. Use redirection so the input to the program comes from a file named Input.txt and the output from the program is saved to the file named Results.txt.
I do not really understand what this is telling me.
Note for mods: this is not a C++ question in any shape or form. I belongs elsewhere.
Let's say you have a program called Q19.exe that reads from standard input (eg console, keyboard) with writes to standard output. How would you run that program if you wanted it to read data from a file called Input.txt and write results to Results.txt?
What do you mean "this is not a c++ question in any shape or form".
Exactly what I said. The question was about how to run a program while redirecting input and output. The techniques to do that are operating system (or shell aka command line interpreter) specific, and have nothing whatsoever to do with C++.
If you've been given this question in a C++ course, the intent is probably that you use the system() function. But the string you will need to supply to the system call will be specific to your host systems.
If a teacher of a C++ course has given this question without any mention that the solution is operating system specific then, frankly, my advice is to find another teacher. (There are sometimes reasons to do such things in a course like "C++ programming for windows" but, even then, it is lousy technique that will make potential employers look at you askance).
As grumpy said, this question is language agnostic. As it is referring to OS redirection of the standard input/output.
The solution is simple; in windows, you can run the program like this:
This will simply redirect the standard input/output to read and write information to a file instead of the console. That means that operations such as std::cin >> x and std::cout << x will read x from Input.txt and write its value on results.txt. It's important to notice that the input and output text files must be in the same directory as the executables and can have any name, not necessarily "input.txt" and "output.txt".
q19.exe <Input.txt> results.txt
Do not hand out answers!!! how is he supposed to learn how or why this works if you just give it to him on a silver platter?!