#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Confused on structs and arrays


    I'm supposed to write a program that is able to save a list of items such as books, CDs, or DVDs. The items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.
    I'm supposed to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.

    The user should be able to

    1. Enter items
    2. Display a list of the items
    3. Save the list to disk
    4. Read the list from disk
    5. Sort the list
    6. Exit the program

    I know I should use arrays and structs but can anyone give me a head start?
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,644
    Rep Power
    1945
    Start with number 1 first.

    Can you be more specific what you need help with? e.g. do you know how to get input from user? how to create a structure/array?

    Have you tried anything? then post the code you have.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    So far I only have

    <iostream>
    <fstream>
    #include
    using namespace std;

    int main()
    {


    fstream file;
    file.open("file.dat", ios::in);

    }

    So pretty much I have nothing. I don't know what my first step should be. How do I create a .dat file?

IMN logo majestic logo threadwatch logo seochat tools logo