Thread: Any way to easily store input from the user(s) "on the side"?

  1. #1
    Frustrated C Programmer
    Join Date
    Sep 2005
    Location
    Florida
    Posts
    5

    Any way to easily store input from the user(s) "on the side"?

    Okay, I'm having a problem with this fairly large program for my C-programming class. The professor is having us make a "menu" program using a while loop -- the program keeps going and taking in input from the user (how much money they are donating) and keeps a running total of how many users have donated and how much has been donated. The user can stop the program by typing in the correct character to stop it.

    There's also a statistics page of the program, where it calculates averages of certain categories who donated and it's supposed to calculate the standard deviation of each category's entries.

    The problem is, to calculate each category's standard deviation, I need to keep every single entry from every single user and store it in the appropriate variables so I can call the correct values back when calculating the standard deviation for each category.

    I can't think of any even relatively easy way whatsoever to do this without adding hundreds of lines of code just to store these variables. We haven't gone over it in class (at least AFAIK).

    Can someone help me out here? Have I missed something major? Or is my professor just asking too much of us?

  2. #2
    Registered User
    Join Date
    Sep 2005
    Posts
    41
    i would say he wants you to store the users input in either a 2d array, link list, tree, etc.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    A regular 1 dimensional array would do, if each donor only donates one amount. Look into arrays in a C book.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cin.getline question (user's input too long)
    By JerryL_MB in forum C++ Programming
    Replies: 1
    Last Post: 12-09-2002, 12:17 PM
  2. Basic C Programming Help Needed
    By Smurphygirlnz in forum C Programming
    Replies: 8
    Last Post: 09-26-2002, 07:12 PM
  3. ComboBox input (BCBuilder users only)
    By Robert in forum C++ Programming
    Replies: 0
    Last Post: 05-25-2002, 10:32 AM
  4. troubleshooting user's input mistakes
    By jagerhans in forum C++ Programming
    Replies: 2
    Last Post: 11-24-2001, 12:41 PM
  5. limiting length of users input
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-20-2001, 09:55 AM