View Full Version : Max, Min, Average of Number String

09-27-2009, 05:08 AM
hey guys. i have several problems but i stuck with these 2 problems. hope you guys can help me out.

1- write a C++ program that reads in an unspecified quantity of real numbers, of quantity < 100, and stops reading them in when the user inputs a character that you tell them to. The program then reports the exact quantity of numbers read in, their minimum, maximum, and average. Report at least 5 different runs of input sets. EX
please enter numbers one at a time, pressing return after each one. when you want to stop, just enter 0 ( a zero)

thank you.
you entered 4 numbers
the largest number is 2066.4, smallest is 15.1, the average is 58.825

2- Pi Estimation with Arctan:
Equation 1: pi/4 = 1-1/3 + 1/5 - 1/7 + 1/9 - ...
which come from the series
arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + x^9/9 - ... by letting x = 1.0
however, rearranging the series produces a different looking equation:
Equation 2: pi/8 = 1/(1x3) + 1/(5x7) + 1/(9x11) + ...
which equation converges on a value of pi faster? write a c++ program that uses both equations 1 and 2, separately, showing how the value of pi changes as each term is added up to 50 terms. Identify which equation converges faster. write the output to an external file instead of to the screen.

any help would be really helpful especially #2.
thank you

Renato Bebić
09-28-2009, 08:47 AM
This looks like classic homework.

09-28-2009, 08:29 PM
Well what are you stuck on? What are your specific questions? What are you unsure about?

09-29-2009, 04:03 PM
i got it guys. thanks oracle

how come i can't edit my original post?

09-29-2009, 05:06 PM
i got it guys. thanks oracle

how come i can't edit my original post?

Because it has been more than 2 days, why would you need to edit anyways? If you want to mark it resolved, it should still let you do that.