Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 635915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:27:28+00:00 2026-05-13T20:27:28+00:00

I am taking a CS class, and most of the assignments were in java.

  • 0

I am taking a CS class, and most of the assignments were in java. in the last java assignment we learned collections. This assignment we are using c++ and i need to learn the STL
The required book is all in java. We were given this webpage http://www.cplusplus.com/
however, that and google is not going to get me through the assignment.
Can you recommend a good book on STL and c++? I need to learn mostly about set and map.

This assignment is about a media library(book,cd,dvd info)

we were given a skeleton program to work with and in the library class i am not sure what the set and map are actually for regarding what goes in what for the book, CD, DVD information..? can someone tell me based off of the functions what goes into what set/map?

typedef set<Item*>             ItemSet;
typedef map<string,Item*>       ItemMap;
typedef map<string,ItemSet*>     ItemSetMap;

class Library
{

public:
// general functions

void addKeywordForItem(const Item* const item, const string& keyword);
const ItemSet* itemsForKeyword(const string& keyword) const;
void printItem(ostream& out, const Item* const item) const;

// book-related functions

const Item* addBook(const string& title, const string& author, int const nPages);
const ItemSet* booksByAuthor(const string& author) const;
const ItemSet* books() const;

// music-related functions

const Item* addMusicCD(const string& title, const string& band, const int nSongs);
void addBandMember(const Item* const musicCD, const string& member);
const ItemSet* musicByBand(const string& band) const;
const ItemSet* musicByMusician(const string& musician) const;
const ItemSet* musicCDs() const;

// movie-related functions

const Item* addMovieDVD(const string& title, const string& director, const int nScenes);
void addCastMember(const Item* const movie, const string& member);
const ItemSet* moviesByDirector(const string& director) const;
const ItemSet* moviesByActor(const string& actor) const;
const ItemSet* movies() const;
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:27:29+00:00Added an answer on May 13, 2026 at 8:27 pm

    Okay, the key question is which operations you need to support. The operations dictate which data structure you should use.

    For example, for books you’ve got:

    const Item* addBook(const string& title, const string& author, int const nPages);
    const ItemSet* booksByAuthor(const string& author) const;
    const ItemSet* books() const;
    

    This means that you need sets of books: all books and by author. Therefore you need a map which maps author to the set of books having that author.

    Your functions might look like this:

    ItemSet allBooks;
    ItemSetMap allBooksByAuthor;
    ...
    
    const Item* addBook(const string& title, const string& author, int const nPages)
    {
        BookItem* item = new BookItem(...);
        allBooks.insert(item); // add to set of all books
        allBooksByAuthor[author].insert(item); // add to set of books by this author
        return item;
    }
    
    const ItemSet* booksByAuthor(const string& author) const
    {
        return allBooksByAuthor[author];
    }
    
    const ItemSet* books() const
    {
        return allBooks;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a blind student who's taking a required UI class. One of the assignments
I'm trying to create a Quicksort base class using VB.NET, taking it an array
I'll be taking a Python-based computer science class next semester using my MacBook Pro.
I am taking a class in C++ programming and the professor told us that
Background: I am taking a class at my university called "Software Constraints". In the
A class I am taking currently requires us to do all of our coding
I am taking a beginning C++ class, and would like to convert letters between
I'm a blind college student who is taking an introduction to programming class that
I'm currently taking a math class in College called Scientific Computing and the professor
I am taking a software development class right now and we are discussing agile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.