C / C++ Workshop


C++ Classes


Example source code

    for loops and while loops

  1. Two factorial programs
  2. A simple number summing program

    User input, if / else statements

  3. A program that asks for vowels
  4. if / else versus the switch statement
  5. if / else versus the ?: operator

    Functions

  6. A simple function that calculates the hypotenus

    Arrays

  7. Normal distribution simulation

    Pointers

  8. Searching a string for a character
  9. Stepping through arrays with pointers

    Structs

  10. A program about planets
  11. The data file for the planets program

    Structs and pointers

  12. A program with complex numbers - 1
  13. A program with complex numbers - 2

    Introduction to classes

  14. Complex numbers as a class

    Operator overloading, copy constructor

  15. Complex numbers main function
  16. Complex numbers class header file
  17. Complex numbers class definition (.cpp) file
  18. Makefile for this program

    File input / output

  19. Reading a file one character at a time with the get() function
  20. Reading a file a line at a time with the getline() function
  21. Reading a file a token at a time with the >> operator
  22. Reading a file in blocks with the read() function
  23. Reading and writing files