Okay. This problem is from "Objects,Abstraction,Data Structures and Design using C++" by Elliot Koffman and Paul Wolf Gang pg127. #2

Implement an array- based program application that manages a collection of DVDs. The data for each DVD will consist of a title , a category, running time, year of release, and price. The user should be able to add new DVDs, to the collection, remove DVD, edit the information stored for a DVD,list all DVDs in a specified category, and retrieve and display the information saved for a DVD given its title.

I need some ideas, especially on creating the remove, add ,and edit functions.

class Collection; // <-- pointers to Category
class Category; // <-- pointers to array dvd[] and std::string description/name
struct dvd_info {
  category* cat;
  std::string title;
  int year;
  double time, price; // <-- time in seconds, use a formatting function

  dvd_info() : cat(NULL), title("\0") { }
  dvd_info( cat *c, std::string &t, int yr, double s, double m ) : cat(c), title(t), year(yr), time(s), price(m) { }
};
Class dvd {
public:
dvd_info* ret_info() { return &inf; } // edit or read from pointer
private:
dvd_info inf;
}

adding should be fairly straightforward, just add a function like this:

Categories::push( dvd_info &d ) { vector.push_back(d); }
/* or whatever container...
You could use std::map for easy use of strings (titles, categories) for searching in the collection(s) */
map.find( std::string("some movie") );
map["some movie"];

If you want more help than that, you have to post some code.

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.