For the following discussion, it's convenient for us to categorize functions functions in two ways:
void function1() { . . . } |
void function2() { if (...) return; ... return; } |
int function3() { . . . return value; } |
int function4() { if (...) return value1; ... return value2; } |
(a) | (b) | (c) | (d) |
double calcPayment(double P, double R, int N) { return P * R / (1 - pow(1 + R, -N)); } |
double calcPayment(double P, double R, int N) { double payment = P * R / (1 - pow(1 + R, -N)); return payment; //return(payment); // superfluous parentheses } |
(a) | (b) |