Next: Exercises Up: Further User-defined functions in Previous: Summary

Review Questions

  1. How is information supplied as input to a function? How can information be conveyed back to the calling program?

  2. What would be the output from the following program?

    void change(int& y)
      {
        y = 1;
      }
    void main()
      {
        int x;
        x = 0;
        change(x);
        cout << x << endl;
      }
    

  3. Write a function prototype for a function that takes two parameters of type int and returns true if these two integers are a valid value for a sum of money in pounds and pence. If they are valid then the value of the sum of money should also be returned in pence (without affecting the input value of pence). If not valid then false should be returned.



Next: Exercises Up: Further User-defined functions in Previous: Summary