Pages

Monday, May 16, 2011

Session Outline: Monday, May 16, 5:10 PM to 6:00 PM SURGE 113

Brief

The goal of this lesson is to get everyone better familiar with creating functions and how to use incremental development (aka Divide and Conquer) using test harnesses.

Outline

  1. [0-10 min] Q & A 
  2. [5-10 min] Go over today's quiz
  3. [10 min] Mini-Quiz
    1. [Break up the following code into separate functions]
      int main()
      {
          int input1 = prompt("Enter a number: "),
              input2 = prompt("Enter another number: ");  


          // Limit input1 between 5 and 9
          if (input1 < 5)
              input1 = 5;
          else if (input1 > 9)
              input1 = 9;

          // Limit input2 between 3 and 7
          if (input2 < 3)
              input2 = 3;
          else if (input2 > 7)
              input2 = 7;


          return 0;
      }
  4. [10-15 min] Review of Functions
    1. Syntax
    2. Forward Declarations 
    3. Overloading
    4. Reference Parameters
    5. Compositions
  5. [5-10 min] Constants
    1. Global Constant Variables vs. Global Variables
  6. [10-20 min] Incremental Development (Divide and Conquer)
    1. Test Harnesses
  7. [5-10 min] Review of Scoping 
    1. int foo()
      {
          int x = 3;
          return x;
      }

      int bar()
      {
          int y = 5;
          return y;
      }

      int main()

      {
          int x = bar();

          int q = foo();

          cout << x << q;


          return 0;
      }
  8. [5-10 min] Review of Dot Operator
    1. Member Functions 

No comments:

Post a Comment