179k views
3 votes
Write the definition of a function isSenior, that receives an integer parameter and returns true if the parameter's value is greater or equal to 65, and false otherwise. So, if the parameter's value is 7 or 64 or 12 the function returns false. But if the parameter's value is 69 or 83 or 65 the function returns true.

1 Answer

5 votes

Answer:

The function definition for this question can be given as:

Function Definition:

bool isSenior(int x ) //function

{

//function body Or function definition.

//conditional statement

//if statement

if (x >=65)

{

return true; //return value true.

}

else //else statement

{

return false; //return value false.

}

}

Step-by-step explanation:

In the above function definition firstly we define a function that isSenior. This function return Boolean value that is true or false in this function we pass the value as the parameter in that function we use the if statement that check the pass value is greater then equal to 65. If the condition is true it return true.else it will return false.

User Saheb Singh
by
4.9k points