CS 1160 C/C++ Programming 12 MWF - Spring 2016

February 22nd, 24th, and 26th - Week #6


Monday 02/22/2016


  1. Test One ONE WEEK FROM ... today ... on Feb 29th, the leap year day.

    Review of Friday's programs: Pass by value and pass by reference. Break pass by reference down into two categories: out and in/out

     out       output only is the purpose of the parameter - to pass back results
    
    void intfrac(float n, float& intp, float& fracp)
    {
       intp = float( long(n) );
    
       fracp = n - intp;
    }
               n       is an input parameter
               
               intp    is an output parameter (call by reference)
               fracp   is an output parameter (call by reference)
              
     in/out    input and output is the role - swap() parameters are example of in/out
    
    void swap( int& numb1, int& numb2)
    {
       int temp = numb1;
       numb1 = numb2;
       numb2 = temp;
    }
                         numb1    is an input/output parameter (call by refereence)
                         numb2    is an input/output parameter (call by refereence)
    
  2. Bubble Sort without a swap() function: bubbleSort.cpp...

  3. bubbleSortWithSwap.cpp... Using the swap() function with its in/out parameters (review of call by reference).

Wednesday 2/24/2016



Friday 2/26/2016


  1. TEST ONE: On leap year day - Monday, February 29th.