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.
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);
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)
Bookmarks