truviet911

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)

15.1

176.6

2066.4

97.2

0

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

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)

15.1

176.6

2066.4

97.2

0

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