logo CodeStepByStep logo


Author: Marty Stepp (on 2016/06/19)

Write a function named xkcdDatingRange that accepts three parameters: an integer for a person's age, and two integer references for a minimum and maximum, and that fills the min/max integers with the person's xkcd "dating range" as described in the following web comic strip:

Your minimum xkcd dating age is half your own age plus 7. Your maximum xkcd dating range is your own age, minus 7, then doubled. For example, the call of datingRange(48, min, max); sets min to 31 and max to 82. You may assume that the age value passed is a non-negative integer.

Type your C++ solution code here:

This is a function problem. Write a C++ function as described. Do not write a complete program; just the function(s) above.

You must log in before you can solve this problem.

Log In

Need help?

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.

© Marty Stepp, all rights reserved.