In my application I've created a sequential access file or often call a text file in Visual Basic.Net. I am wondering how can I code the program to calculate the average of all the data from the sequential access file?
Example: Let say my money program ask me to enter the amount (one at a time) of all the things I bought today and the amount I enter would store in the sequential file. The money program has a average button that will calculate the average of all amount I spent. How can code the average button to read all the amount I enter in the sequential file and give me the average? Program examples would be helpful.
Thank you.© BrainMass Inc. brainmass.com December 24, 2021, 5:13 pm ad1c9bdddf
Create an integer variable sum in the subroutine. Now read teh first entry of the file and add it to sum, such as:
sum = sum + (entry from the ...