Return To CS 110 Home

Colour Theme   Font Size Options
 
   
   
   
Exercise 2

EOF Loops Exercise

Use ex2_iodemo.cpp in the replit team project or copy the following code into your IDE:


This program uses file I/O to read floating point values from the data file inputfile.txt until the end of the file is reached. It then writes the sum and average of all the floating point numbers to the output file outputfile.txt.

Your assignment is to add the code to the while loop to read a number from the file, add it to the sum, and increment the counter. Look at the comments in the program to see where to put this code.

Instructions:

When you are done: