Colour Theme Font Size Options
 
 
 
Exercise 2

Six Lines File I/O Exercise

Given the following files:

  • Copy the following code and use the name ex2_readline.cpp in your Visual Studio or other IDEs:
  • Create the input file ex2_input.txt in the Visual Studio project or in another IDE with the following content:
        
    Allan Smith John Cooper Zhang Hua Yao Ming

Do this:

  • Edit the input data file ex2_input.txt and the program file ex2_readline.cpp in Visual Studio.
    • Add your full name and your CS110 class instructor's name in the input data file ex2_input.txt a line for each.
    • Modify the program ex2_readline.cpp to work with your new input data file.
  • Compile and run the program ex2_readline.cpp.
  • Check the contents of the output data file.

When you are done:

  • Observe the results in ex2_output.txt. Check with your lab instructor if you aren't sure if they are correct.
  • Take a screenshot of your IDE and console window after running the program - there should be no output there.
  • For this exercise, you will have: ex2_readline.cpp, ex2_input.txt and ex2_output.txt files.
  • Complete all the exercises in this lab and upload the .cpp files and .txt files and screenshots in the UR COurses.

I/O file video instructions for our supported Desktop IDEs: