|
-
April 18th, 2007, 04:05 PM
#5
Re: Please Help Calling function
if the value of z is more than twice the value of first return z; otherwise , return 2 times first minus z.
This is different to what you originally posted and is why I couldn't make any sense of the statement you did provide. It is still ambiguous
2 times first minus z
is that
(2 * first) - z
or
2 * (first -z)
Given the nature of the check to see if z > 2 * first, I suspect it is the former, since this prevents the result from being negative.
This makes function two read as
Code:
double FunctionTwo(int x, double a)
{
double z;
cin >> z;
z += a;
int first = FunctionOne(6,8);
first += x;
return (z > (2*first)) ? z : (2*first) - z;
}
I also note you haven't modified your one and two functions as I posted earlier for you. If you want to pass your assignment with a decent grade, then use the stuff I posted, which is better coding.
Regards
Alan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|