|
// file DShelf003.cpp // authors AOU // date 2006.02.13 /* for a book of width 5 and id 1: 15 CBook books[MAX_SHELF_WIDTH] 11111 int a[MAX_SHELF_WIDTH] function | int a[MAX_SHELF_WIDTH] vs CBook books[MAX_SHELF_WIDTH] ------------------------------------------------------------------------------ constructorDefault | | isValid | |better constructorRandom | |better constructorWidth | | constructorFragmented| |better insertAtLeft | |better displayDetailed | | displaySimple |better | displayBrief | | isEmpty | | randomBook | |better randomBookPointer | |better search | |better remove_byID | |better remove_byPointer | |better reclaimSpace |better | reclaimableSpace | |better ------------------------------------------------------------------------------ */ #include <iostream> using namespace std; // Constants int const UNDEFINED = -9; int const MIN_SHELF_WIDTH = 5; int const MAX_SHELF_WIDTH = 40;//100; int const MIN_BOOK_ID = 1; int const MAX_BOOK_ID = 9;//100; int const TEST_COUNT = 10; class CBook { private: int id; int width; public: CBook(void); }; class CDShelf { private: int width; // width of the bookshelf int count; // number of books on shelf int widthOccupied; // total width of book on shelf // should it include empty holes? // should not include empty holes // instead use spaceAvailable int a[MAX_SHELF_WIDTH]; //vs CBook books[MAX_SHELF_WIDTH]; public: }; void main(void) { cout << "Hello\n"; } /* // book id, 0 for book removed // book width // pointer to book on right // pointer to book on left // points to the leftmost book // points to the rightmost // width of the bookshelf // number of books on shelf // total widt of book on shelf // test_constructorDefault // test_isValid // test_constructorRandom // test_constructorWidth // test_constructorFragmented // test_insertAtLeft // test_displayDetailed // test_displaySimple // test_displayBrief // test_isEmpty // test_randomBook // test_randomBookPointer // test_search // test_remove_byID // test_remove_byPointer // test_reclaimSpace // test_reclaimableSpace */ |