Is this right? I can be sure...

For another assignment, our teacher asks us to take four sum functions (which take from 2, up to 5 variable) and have the last three functions call the one before it.

The only detail I don't understand is this: Does she want me to call the previous function within the function call, like so:

sum(sum(one, two), three);

or does she want me to call it like this:

1
2
3
4
5
6
7
sum(one, two, three)
{
int add2;
add2 = sum(one, two) + three;
cout << "Sum of 3 #s is: " << add2 << endl;
return 0;
}


Knowing this would help me finish this so I don't end up writing two different programs, one of which may not even work.
Last edited on
The former. If you use a function, ever, it must have its own set of parens.

To disambiguate since this is an assignment, you could just assign the result of 1+2 into a temp variable and use that variable in the second sum function. Orrrr you could just use the + operator =)
Topic archived. No new replies allowed.