CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Newbie at C++

  1. #1
    Join Date
    Nov 2012
    Posts
    2

    Newbie at C++

    This is considered pretty basic stuff but I just started programming and I'm pretty confused on my assignment.

    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 I don't where to start.

  2. #2
    Join Date
    Nov 2012
    Posts
    2

    Re: Newbie at C++

    This is all I have so far
    #include <iostream>
    02 #include <fstream>
    03 using namespace std;
    04
    05
    06 int main()
    07 { 08 09 10 fstream file;
    11 file.open("file.dat", ios::in);

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Newbie at C++

    Quote Originally Posted by NG22 View Post
    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 know I should use arrays and structs but I don't where to start.
    Hmm, I always thought that in C++ one should use some classes...
    Note also that there are a lot of container classes (arrays, lists, maps, ...) in STL (as well as in MFC framework)
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured