CIS 250 (C++ II) Demonstration Programs

Input, Output, File I/O

  1. cinfunc.cpp: some basic istream functions
  2. manips.cpp: output formatting using stream manipulators
  3. fileio1.cpp: simple text file I/O
  4. fileio2.cpp: binary file I/O
  5. fileio3.cpp: random access file I/O

Passing by reference

  1. demoref.cpp: demonstration of reference variable
  2. demobyref.cpp: demonstration of old way of passing references using pointers

Classes and structs

  1. demostruct1.cpp: demonstration of struct usage
  2. demostruct2.cpp: nested structs and an array of structs
  3. Point.cpp: simple class demonstration
  4. democlass1.cpp: demonstration of class usage
  5. democlass2.cpp: using header files with classes
  6. Demonstration of many class techniques including dynamic memory allocation
  7. Updated person class including operator overloading, friend functions, and a copy constructor
  8. polytest.cpp: demonstration of inheritance, polymorphism, and virtual functions

Sorting

  1. sort.cpp: various sorting algorithms

Array, vector, stack, queue, deque

  1. array1.cpp: declaring and passing arrays to functions
  2. array2.cpp: arrays and pointer arithmetic
  3. array3.cpp: multidimensional arrays, array initialization
  4. array4.cpp: multidimensional arrays and pointer usage
  5. array5.cpp: arrays of strings
  6. array6.cpp: sorting arrays
  7. testVect.cpp: the vector class demonstration program demonstrated during lecture
  8. TestContainers.cpp: demonstration of deque, stack, and map containers

Variable and default arguments, overloading functions and operators, templating

  1. overload1.cpp: overloading functions
  2. testVar.cpp: variable argument demonstration
  3. default1.cpp: default function arguments
  4. Demonstration of operator overloading
  5. template1.cpp: function templating

Enumerations, namespaces

  1. testEnum.cpp: enumeration demonstration
  2. Demonstration of namespaces

Data structures

  1. Linked list demonstration
  2. Templating linked lists
  3. Stack: stack.h       TestStack1.cpp
  4. Stack with templating (stack size set at instantiation): stackt.h       TestStack2.cpp
    Note: This class creates an array to hold the stack.
  5. Stack with dynamic allocation (stack can grow and shrink) and templating: stackd.h       TestStack3.cpp
  6. Queue with dynamic allocation and templating: queued.h       TestQueue3.cpp

Recursion

  1. recurse.cpp: demo of recursive functions
  2. recursion.cpp: more complete demonstration of recursive functions
  3. Fibonacci2.cpp: more generalized recursive Fibonacci program
  4. RecursiveLargest.cpp: finds the largest array element recursively

Miscellaneous

  1. testToken.cpp: string tokenization demo