A) Write the prototype for a function named isTeenager . The function should hav
ID: 3816124 • Letter: A
Question
A) Write the prototype for a function named isTeenager. The function should have an integer parameter named age. When isTeenager is called, it should return a boolean to indicate that the given age is in the "teenage range". Just write the prototype for this portion of the question.
B) Implement a function named isTeenager. The function should have an integer parameter named age. when isTeenager is called, it should return a boolean to indicate that the given age is in the "teenage range". Specifically the function should return true if the given age is between 13 and 19 (inclusive) and it should return false otherwise.
Explanation / Answer
Here is the prototype and the implementation in C++ for you:
#include <iostream>
//isTeenager prototype.
bool isTeenager(int);
//isTeenager implementation.
bool isTeenager(int age)
{
return age >= 13 && age < 20;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.