The first thing you need to do in a driver is open two special files: pfin and pfout. Pfin is connected to the output of the submitted program. And, pfout is connected to the input of the submitted program. So anything that the submitted program outputs (e.g. using printf) can be read from pfin. And, anything you write to pfout can be read by the submitted program (e.g. using scanf).
At the end, you need to print a single integer from the driver. If the integer is 0, it implies that the submitted program behaved in an expected way (i.e. the test case passed successfully). Otherwise, you can print a non-zero positive number to indicate that the submitted program failed to produce the correct behavior.
The driver program can read the test input through scanf. For this problem, each test input has a single integer.
|#||Contents of Test Input|
The output part of a test is irrelevant in case of interactive problems. It is also not expected that interactive problems will have sample test cases. Rather, an example interaction should be included as a part of the output specification in the statement.