Introduction to Programming and C++

In some cases, a student may fail ECE 150 Introduction to Computing and yet be promoted before being able to clear that failure. As a result, some students are very frustrated coming into ECE 250, and some, unfortunately, will resort to plagiarism. The following is a sequence of lessons which start at more-or-less the very beginning of ECE 150 and take it from there. Even if you passed, or did well in ECE 150, I think there are enough interesting tid-bits and facts which would make reading these worth your while.

If you do not have access to a C++ compiler, please download and install Dev C++.

The first tutorial is located here. An expanded version of the first tutorial is here together with the source in a zip file.

Topic 0: Introduction

  1. What all this, then?

Topic 1: The Basics

  1. Hello World!
  2. Commenting Your Code
  3. Built-In Data Types
  4. Variables
  5. Location of Variables
  6. Selection Statements
  7. What's Really True? (Type Promotoion and Casting)
  8. While Loops
  9. A Short-Cut To Mushrooms
  10. For Loops
  11. A First Lesson in Pointers
  12. Pointers with Arrows
  13. Pointers into the New World
  14. Problems with Pointers
  15. Arrays
  16. Constant Variables const
  17. Arrays are ... Pointers?
  18. The Static Nature of Arrays
  19. Dynamic Arrays
  20. Resizing Arrays
  21. Functions
  22. Pass by Value
  23. Passing Arrays
  24. Pass by Reference (typename &)
  25. Refactoring Functions
  26. Returning by Value and by Reference

Topic 2: Classes

  1. #ifndef Preprocessor Directive
  2. #include Preprocessor Directive
  3. Namespaces and using
  4. Class Declaration
  5. Global Function Declaration
  6. Templates
  7. Class Member Declaration
  8. Visibility (public, protected, private)
  9. Member Variables
  10. Static Variables
  11. Class Constant
  12. Constructors
  13. Destructor
  14. Copy Constructors
  15. Assignment (operator =)
  16. Accessors
  17. Mutators
  18. Friends
  19. Initializing Static Variables
  20. Class Member Function Definitions
  21. Accessing Protected Base Member Variables in Derived Classes with Templates
  22. . versus ->
  23. Linked List Example

Topic 3: Miscellaneous Features

  1. The Preprocessor
  2. Do-While Loops
  3. The Ternary ?: Operator
  4. Nice Return Statements
  5. Can this == 0?
  6. What is the difference between 0 and NULL
  7. ++i versus i++
  8. #include <iostream> versus #include <iostream.h>
  9. Breaking out of Loops (and using goto)
  10. The switch statement
  11. Deleting this
  12. Pointer Arithmetic

Topic 4: Debuggers

  1. Introduction to Debuggers

Topic 5: C for C++ Programmers

If you intend to do serious programming in C, I recommend Steve Oualline's Practical C Programming, published by O'Reilly & Associates, Inc.

  1. Printing (C's cout)
  2. Comments
  3. For Loops
  4. Casting
  5. Strings
  6. Dynamic Memory Allocation
  7. Structures (Class without the Bells and Whistles)
  8. Scanning (C's cin)
  9. More Strings
  10. Trees in C

Appendicies

  1. Binary and Hexadecimal Numbers
  2. ASCII Characters

Ideas

I need a chapter on expressions and precedence. Instead of overwhelming students with one big table of precedence, we should start with + - * / and =, followed by increasing this precednece table with each new operator.

Acknowledgements

A number of students have looked at these pages and provided feedback. Those who have provided feedback are listed here and their assistance is greatfully acknowledged.

  • Minoli Pathirane