i am writing a program that opens a text file gets data from the user and calculates the daily totals and displays them, as the data is entered daily how do i store these totals so that the program can give monthly totals.
i am writing a program that opens a text file gets data from the user and calculates the daily totals and displays them, as the data is entered daily how do i store these totals so that the program can give monthly totals.
You could store them in an array or other appropriate data structure, but the easiest way is to maintain monthly values in a variable or two and add to them each time you compute a new daily value.
-Prelude
My best code is written with the delete key.
please bear with me i am a newbie but the problem i am having is that the program is run every day to compute the totals but the monthly totals are erased every time the program is run. is there any way to store values when the program is not running or will i have to read these monthly values from the file every time it is opened and if so how ??? please somebody put me out of my misery
Last edited by hen; 07-08-2002 at 03:15 PM.
Ah, I see. In that case you will want to write the monthly values to a separate file and each time new daily values are calculated, read the monthly values into variables, add the daily values to them and then write them back to the file before terminating.
-Prelude
My best code is written with the delete key.
thanks alot prelude