COP 3014 Recitation - Week 3

Functions and Pointers

  1. Copy this program
  2. Next we will modify the program by adding a function named "calcAverage". Everything from "int num1;" to the last cout statement should go inside of calcAverage
  3. Next we will modify the program to have our function take parameters. The "main" function should read in num1, num2, and num3 instead, then it will send num1, num2, and num3 to our "calcAverage" function. instead. The main function will then provide our second function with the numbers.
  4. Let's do this together
  5. Let's do this together
  6. Let's do this together
  7. Type this code. Pay attention to what you're typing.
  8. Now use pointers of type "double" instead of pointers of type "int".

    Program examples, the "pointer.cpp" examples
  9. What's wrong with this?
  10. What's wrong with this?
  11. What's wrong with this?
  12. What's wrong with this?
  13. What's wrong with this?
  14. What's wrong with this?
  15. What's wrong with this?
  16. What's wrong with this?
  17. What's wrong with this?
  18. What's wrong with this?



COMMENTS