Thread: storing values

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    16

    Angry storing values

    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.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    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.

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    16
    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.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    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.

  5. #5
    Registered User
    Join Date
    Jun 2002
    Posts
    16
    thanks alot prelude

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Storing values in strings
    By scotty4598 in forum C Programming
    Replies: 9
    Last Post: 04-29-2009, 10:15 PM
  2. Storing int and double type values under one variable name
    By Thanuja91 in forum C++ Programming
    Replies: 10
    Last Post: 10-30-2007, 04:15 AM
  3. Sending values to a control
    By Zyk0tiK in forum C Programming
    Replies: 6
    Last Post: 12-02-2005, 06:29 PM
  4. Checking ascii values of char input
    By yank in forum C Programming
    Replies: 2
    Last Post: 04-29-2003, 07:49 AM