Hey guys, I'm almost done with my assignment but it seems as though it's only running the If statement in the function, what can I do to fix this, and are there any other pointers for this program you can give me.
Also, you want to change the order of that if-else tree. The general case (if gender is M or F) should be the last, not the first. The more specific each if statement, the closer to the top it should be. So for it to work, the order should be (by line number of if statements):
Since you started a new thread and thus we do not have the original problems statement, it is hard to tell.
This should probably be solved using if ... else if ... else (may be several else if) and possibly imbedded additional if statements. However, it does not look like you are taking advantage of the chain of the ifs. So for example:
1 2 3 4 5 6 7 8
if (conditionA) {
/* do something assuming conditionA is true (not zero) */
} else
/* Now I know that !conditionA and I do not need to retest it. */
if (conditionB)
/* Now do something assuming !conditionA && condition B */
/* and so on */