CS1711 Lab Test example

You must write your name on this instruction sheet and submit it before leaving the lab. Comments regarding your program and your grade for the lab test will be written on the bottom of this sheet and returned to you once marked.

There is no outline file for the test, so you will have to write a complete program. Your grade will depend not only on whether your program compiles and runs, but also on whether you have implemented the program according to instructions, have included proper documentation and have taken account of possible user errors.

At the end of test submit your program to the dropbox corresponding to the time of your lab. The steps following describe what the test program should do.

  1. The user is prompted for an integer N and a filename, which are read from the terminal screen. Use a function named in\_file\_data with suitable parameters to accomplish this.
  2. For the file named in the previous step, the program returns the N'th line in reverse order if possible (i.e. if the file has at least N lines.) Otherwise it reports the number of lines in the file.