Create input.txt file that contains input which you would otherwise type during program's execution.
Move the file into your project's directory (this is where the project files are).
In Visual Studio, go to Project->Properties, select 'Debugging' and in 'Command arguments' put '< input.txt'. (without the quotes)
The 'Working directory' is by default directory of your project files, so you don't need to change it.
When you run your program from within Visual Studio, the input from the file input.txt will be redirected to your executable.
 
How to redirect input & output in Cygwin/Linux/FreeBSD
 
At the command prompt simply type: program.exe < input.txt > output.txt
 
Cygwin
 
You probably already have Cygwin on your laptop (part of the RPI
default installation). What is it? It's a UNIX environment for the
Windows Operating System. You can do all of your work for this class
using Cygwin, g++, and a text editor such as Emacs (i.e., you don't
need to use Visual Studio). Read more about Cygwin here: