If the user wants to read the input from a file, then the output will also go into a different file. If the user wants to read the input interactively, then the output will go to the screen.
Your initial menu will look like the following:
Menu
<1> Read data from a file
<2> Read data interactively
Enter choice:
Here is a sample input file:
21 25
30 30
10 12
55 60
-1 /* this is the flag to end inputting the assignment data */
21 25
30 30
10 12
21 25
30 30
Here is another sample input file:
21 25
30 30
10 12
55 60
-1 /* this is the flag to end inputting the assignment data */
21 25
-1 /* this is the flag to end inputting the midterm exam data */
21 25
30 30