In the program we called ``mult'' which multiplied two numbers, we typed those two numbers in at the keyboard. We can get input from a file if we redirect the input.
Create a new file called data. In that file, put two numbers which you would like to find the product of. Save that file. Supposing that the name of the executable was mult, type :
mult < data
What happened? The contents of the file data were used as input to the mult program.
It may seem silly to do this now. Obviously it is much faster to simply type in the two numbers when the program asks. But you will soon find that in future programs, you will have to input large numbers of data, and you'll want to use this indirection.
You can also redirect the output to a file. Type:
mult < data > output
This spits the answer (all the output) into a text file called output.