Code is NOT hieroglyphics.
Learn to read it.
cs_logo

CS 626
Object-Oriented Principles and Practices

Selected Code Examples
Fall 2016
Email A.Fischer at work Email A.Fischer at home
Course Home Page
Administrative FAQs
Technical FAQs
Lecture Notes
Programming Project
Chapters from the Text
Code Examples

<< Back
Bark
Reading code isn't impossible.
Red bark./
Peeling bark
It's bark is worse than its byte.
Lichens
Branches
But watch out for branches.
 
Click the link for the chapter you want; your browser should download a normal code, data, or pdf file for you. If the downloaded file is NOT a normal text file, find a different way to download it or use cut-and-paste with the mouse to extract the code from the HTML window.

  1. Tools files for use with C++ programs: tools.hpp,   tools.cpp.

  2. Chapter 2: Data pack in C++: main.cpp,   pack.cpp,   pack.hpp   data file.

  3. Chapter 3: Inventory in C++. main.cpp,   part.cpp,   part.hpp,   old print.cpp,   IOmain.cpp,   getline.cpp.

  4. Chapter 4: Using a Stack to Balance brackets.
    The Stack application in C:   (Include tools.c and tools.h in your project.)   main.c,   stack.h,   stack.c,   token.h,   token.c.

    The Stack application in C++:   (Include tools.cpp and tools.hpp in your project.)   main.cpp   stack.hpp   stack.cpp   brackets.hpp   brackets.cpp   token.hpp   token.cpp

  5. Chapter 5: Functions and Parameter Passing:  oddM.cpp,   odds.cpp,
    odds.hpp,   retM.cpp,   returns.cpp

  6. Chapter 6: Objects, Allocation, and Disasters:  assign.cpp,   brackets.cpp,   dangle.c  dangle.cpp,   delestack.cpp,   limbo_walk.cpp,   limbo_jump.cpp, useNull.cpp,   walk.cpp,   wisdom.cpp,

  7. Chapter 7: Bells and Whistles.:  main.cpp,   box.hpp,

  8. Chapter 8: Interacting Classes:  graphM.cpp,  graph.hpp,  graph.cpp, row.hpp,  row.cpp,  item.hpp,  scores.in.

  9. Chapter 9: Array Data Structurres
    Menu (ragged array): main.cpp,   getRag.cpp.
    Flexible array of chars: flex_test.cpp,   flexChars.hpp,   flexChars.cpp.
    Array Qsort: main.cpp,   sarray.hpp,   sarray.cpp,   compare.hpp.
    Typing Tutor: main.cpp,   flexString.hpp,   flexString.cpp,   sstore.hpp,   sstore.cpp,   dictionary.hpp,   dictionary.cpp,   vocab.in.

  10. Chapter 10: Construction and Destruction.
    Constructor demo: ballM.cpp,   ball.hpp.
    Box, Van and Layers example: layersM.cpp,   layers.hpp,   vanM.cpp,   van.hpp,   van.cpp,   box.hpp.

  11. Chapter 11: Makefile.

  12. Chapter 12: Derivation.
    Pubs, Printed and Book example: main.cpp,   Pubs.h,   Printed.h,   Book.h

  13. Chapter 13: Templates.
    Precedence parser: evaluateM.cpp,   stackT.hpp,   flexT.hpp,   eval.hpp,   eval.cpp,   operator.hpp.

    Standard Template Library: string,   vector and vector::iterator,   map and map::iterator.

  14. Chapter 14: Hangman. Makefile,   main.cpp,   game.hpp,   game.cpp,   board.hpp,   board.cpp,   words.hpp,   words_d.hpp,   words_d.cpp,   rstrings.hpp,   rstrings.cpp,   sstore.hpp,   sstore.cpp,   flexT.hpp,   flexFind.hpp,   vocab1.in.

  15. Chapter 15: Polymorphism and Virtual Functions. Makefile,   main.cpp,   cell.hpp,   exam.hpp,   item.hpp,   contain.hpp,   linear.hpp,   linear.cpp,   queue.hpp,   stack.hpp.

  16. Chapter 16: Multiple and Virtual Inheritance. Makefile,   main.cpp,   ordered.hpp,   cell.hpp,   item.hpp,   list.hpp,   pqueue.hpp,
    donut.cpp,   donut.hpp,   naming.cpp,   const.cpp,   assign.cpp.

  17. Chapter 17: Exceptions.
    First version: except.hpp,   cards.hpp,   cards.cpp,   bad.hpp. Exceptions with a virtual function: except.hpp,   cards.hpp,   cards.cpp,   bad.hpp

  18. Chapter 18: Patterns. No code in this chapter.

  19. Circular sorted list:
    main.cpp,   Person.h,   CSList.h,   CSList.cpp. Diagrams for the insertion sort: A newly constructed circular list named cs, The list after inserting one Person, Ready to begin an insertion scan, Scan stopped after first Person and second Person was inserted, After 3rd scan, ready to insert 3rd Person, After 3rd insertion,   Final sorted list, after the sixth insertion.

Last updated: 3/19/09