I wrote this little if...else statement but dont know where I got it wrong
/* Question : Write your code to assign value -1 to 5 to the variable 'ageResult', depending on the value of variable 'age'.
int age : Age of a person
int ageResult: Store the resultant value in this variable */
ageResult: Store the resultant value in this variable
Remove every cout and cin from your function.
Q: What is wrong here:
1 2 3
void foo() {
return42;
}
A: a mismatch; the function promises to return no value (void), yet it tries to return an integer (42).
1 2 3 4 5 6 7
if ( foo < 42 ) {
// something
}
elseif ( // Q: What do we know at this point?
// A: We would not reach this else branch if foo were less than 42
// Therefore, we do not need to test whether 42<=foo, because it must be
)