Review Questions

1:What kinds of functions are good candidates for inline status?
2:Suppose the song() function has this prototype:
void song(char * name, int times);
  1. How would you modify the prototype so that the default value for times is 1?

  2. What changes would you make in the function definition?

  3. Can you provide a default value of "O, My Papa" for name?

3:Write overloaded versions of iquote(), a function that displays its argument enclosed in double quotation marks. Write three versions: one for an int argument, one for a double argument, and one for a string argument.
4:Here is a structure template:
struct box
{
    char maker[40];
    float height;
    float width;
    float length;
    float volume;
};
  1. Write a function that has a reference to a box structure ...

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.