-
November 22nd, 2012, 04:07 AM
#1
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.
-
November 22nd, 2012, 05:20 AM
#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);
-
November 22nd, 2012, 05:52 AM
#3
Re: Newbie at C++
Originally Posted by NG22
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|