Chapter 7

A1: The three steps are defining the function, providing a prototype, and calling the function.
A2: [click here]
  1. void igor(void);

  2. float tofu(int n); // or float tofu(int);

  3. double mpg(double miles, double gallons);

  4. long summation(long harray[], int size);

  5. double doctor(const char * str);

  6. void ofcourse(boss dude);

  7. char * plot(map *pmap);

A3:
void set_array(int arr[], int size, int value)
{
    for (int i = 0; i < size; i++)
        arr[i] = value;
}
A4:
 double biggest (const double foot[], int size) { double max; if (size < 1) { cout << "Invalid array size of " << size << "\n"; cout << "Returning a value of 0\n"; return 0; } else // not necessary because return terminates program { max = foot[0]; for (int i = 1; i < size; i++) if (foot[i] ...

Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.