A cancellation error occurs when you are manipulating a very large number with
a very small number. The large number may cancel out the smaller number. For example, the
result of 100000000.0 + 0.000000001 is equal to 100000000.0. To avoid cancellation errors and
obtain more accurate results, carefully select the order of computation. For example, in
computing the following series, you will obtain more accurate results by computing from right to
left rather than from left to right:
Write a C++ program that compares the results of the summation of the preceding series,
computing from left to right and from right to left with n = 10, 100, 1000, and 10000.
Use a long double variable and accumulator for the summation.
Avoid mixed mode expressions.
May use a while or for loop (or both), but will need to nest the loops.
There is no input from the user.
Output the two summation values and the absolute value of their difference in a table
with the value of n.
n Left to right Right to left Abs(diff)
I wrote something that worked but it is so ugly and inefficient im scared to show it to my instructor.
I'm not asking anyone to write this for me, but i would appreciate some ideas about how you might approach this particular program. Thanks.