Farmlord 0 Newbie Poster

Hi there just doing some work where i need to produce a database in C++ for DVD now I have done most of it but I’m stuck on some bits. I have split the database up into different files but I will post the files which are important. I just need help on how to do a search function. I got told it’s called "Bubble search" and then a delete function which i think is called "Vector delete". Thank you for your time.

P.S its a simple program so don’t laugh :P. Not the best programmer :)

My header file

      #ifndef DVD_DB_H
02  #define DVD_DB_H
03   
04  #include "dvd.h"
05  #include <vector>
06   
07   
08  class dvdDB
09  {
10      private:
11      std::vector<DVD> dvds; // A container that contains an arry of DVDs
12   
13      public:
14          void insert();
15          void list();
16          void listArtist();
17          void deleteDVD();
18          void fileLoad();
19          void fileSave();
20  };
21   
22  #endif

**My file for the header **

#include "dvdDB.h" //Calls the header file
02  #include <iostream.h>
03   
04  void dvdDB::insert() // First function for inserting a DVD
05  {
06      std::string title, artist, category; //Variables
07      int         year; //Variable
08       
09      std::cout << "Please enter the title of the DVD: ";
10      std::cin >> title;
11       
12      std::cout << std::endl;
13       
14      std::cout << "Please enter the year: ";
15      std::cin  >> year;
16       
17      std::cout << std::endl;     
18       
19      std::cout << "Please enter the artist: ";
20      std::cin >> artist;
21       
22      std::cout << std::endl;
23       
24      std::cout << "Please enter category";
25      std::cin >> category;
26       
27      std::cout << "DVD has been stored...";
28       
29      std::cout << std::endl;
30       
31      dvds.push_back(DVD(title, year, artist, category)); //Will give a new slot for a new DVD
32  }
33  void dvdDB::list() //Will list the DVD
34  {
35      for(int i = 0; i < dvds.size(); i++) //Loop to display all my DVD which has been stroed.
36      {
37          dvds[i].display();
38      }
39  }
40  void dvdDB::listArtist() //Will list all the DVD by artist
41  {
42      for(int i = 0; i < dvds.size(); i++)
43      {
44          dvds[i].display();
45          //bubble sort
46      }
47  }
48  void dvdDB::deleteDVD() //Will delete DVD
49  {
50      int i
51      list();
52      std::cout <<"Enter the number for the DVD to be deleted";
53      std::cin >> i;
54       
55       
56      //use vector function called 'delete'.
57  }

So again just need help on the delete bit and search bit. Thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.