CShelf001
Home ] Up ]

 

//CShelf001.cpp
//Author: AOU
//2005.11.18

/*
data structure:
  booksOnshelf (firstBook, count, totalWidth)
  book (id, width, bookOnRight)
functions:
init
add(bookID, bookWidth)
remove(bookID)
displayAll
end/displayBrief
search(booID)

*/

#include<iostream>
#include <fstream>
#include <ctime>
using namespace std;

class CBook;

class COnShelf
  {
  private:
    CBook *firstBook;
    int count;
    int totalWidth;
  public:
    COnShelf(void);
    bool insertAtLeft(int bookID, int bookWidth);
    bool remove(int bookID);
    void displayDetailed(void) const;
    void displaySimple(void) const;
    void displayBrief(void) const;
    bool search(int bookID) const;
  };

class CBook
  {
  private:
    int id;
    int width;
    CBook *bookOnRight;
  public:
    CBook(void);
  };

void main(void)
  {
  }