Thread: C++ data storage

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    11

    C++ data storage

    I am working on a C++ project to make a statistics spreadsheet i.e. for a sports team. I need to know how to store data once it is entered. For instance I would like to be able to enter a stat like how many points a player scored in one game and be able to bring up that program at a later date and still have that entry available. Any help at all would be awesome.
    Last edited by aewing30; 04-28-2008 at 11:33 AM. Reason: spelling error

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    If your just wanting to use C++ console applications.
    std::cout //Show output on screen
    std::cin //get input from user
    std::getline //get input from user
    std::string //store string input
    std::ifstream //load from file
    std::ofstream //save to file

    will be of a lot of use. Any specific question can be answered more thoroughly.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    So I would use std:fstream to save the data to a file and then open the console and use ifstream to load the file again, or would I need to do an if statement or somethin like that in order to load the data to the original program/

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    just skip the console thing and you are close
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If you are looking for a spreadsheet kind of program, why not just use existing spreadsheet software?

    If not, then perhaps you would like to consider using say, a relational database?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    well i'm doing it as a project in a programming class. I need to use c++. what is a relational database?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. data structure design for data aggregation
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 05-20-2008, 06:43 AM
  2. question about a working linked list
    By cold_dog in forum C++ Programming
    Replies: 23
    Last Post: 09-13-2006, 01:00 AM
  3. Reading a file with Courier New characters
    By Noam in forum C Programming
    Replies: 3
    Last Post: 07-07-2006, 09:29 AM
  4. All u wanted to know about data types&more
    By SAMSAM in forum Windows Programming
    Replies: 6
    Last Post: 03-11-2003, 03:22 PM
  5. C Programming Question
    By TK in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 07-04-2002, 07:11 PM