I am not asking for you to build the program but can you explain to me what does this mean? I mean what does it want to have in the C++?
Derive the flowchart to carry out the following
steps then implement it in C program :
a. Store the absolute difference of x and
y, where the absolute difference is
(x-y) or (y-x), whichever is positive.
Do not use the abs or fabs function in
your solution.
b. If x is 0, add 1 to zero_count. If x
is negative, add x to minus_sum. If x
is greater than 0, add x to plus_sum.
"zero_count", "minus_sum" and "plus_sum" are all variables that you are supposed to create. It's implied but not directly stated, at least not in the excerpt that you provided.
I can see your point about the variable x in (b) vs (a). A given variable is normally defined once. so the x in (b) should be the same one as in (a). But given the maths, it looks like it should be using the absolute difference.
If I came across confusion of that kind, I'd e-mail the guy who wrote the spec. It's not that uncommon for confusion to turn up!
You could state your assumptions, once you decide which to use, and then just go with it.
The only variables whose value is uncertain are the counts.