示例#1
0
void Shop::AddBook(const char* pTitle, 
                unsigned int unitPricePence,
                unsigned int noOfPages)
{
    std::shared_ptr<Item> newbook (new Book(std::string(pTitle), unitPricePence, noOfPages));
    list.push_back(newbook);
}
示例#2
0
文件: List.c 项目: asilva3/CMPS101
/*
 * THe method pointbook() returns the pointer to the book searched for
 * passing in the listhandle, bookname, and the bookid
 */
void pointbook(ListHndl L, char* bookname, ListHndl bookid)
{
  (void*) bookname;
   NodePtr book = newbook(bookname, bookid); 
   if(L->last == NULL)
   {
      L->first = book;
      L->last = book;
   }
   else if(L->last != NULL)
   {
      L->last->next = book;
      book->prev = L->last;
      L->last = book;
   }
   L->size = L->size + 1;
}