Project #13330 - C++

here is what you should do

 

1 Purpose
This program introduces the need for design of a simple algorithm which can perhaps be best
completed with a set of auxiliary functions. The design and implementation will provide the
student with practice in function declaration, de nition and use. The required computations also
demand care in data type manipulation.
2 Procedure
1. Your task is to write a C++ program which computes the approximation of  by a series
summation known as the MadhavaLeibniz series. A concise overview is provided on the
following web link:
http://en.wikipedia.org/wiki/Leibniz formula for pi

USE LINK FOR THE FORMULA
The formula is given as follows:
 = 4
1X
k=0
(????1)k
2k + 1

 


2. Your program should prompt the user for one integer, the largest value of the index k in
the truncated summation of the formula.
(a) NOTE: your program should demand that the value input be nonnegative. More
speci cally, it should continue to prompt for a value until an integer equal to or greater
than 0 is entered.
(b) The result should be displayed to at least 10 digits to the right of the decimal point.

 

 

 

 

 (d) A text..Prog05Test.txt which contains demonstration dialog of your programs
behavior.
Insert comments in this le regarding the validity of your results (for example, demon-
strate that the user inputs are handled as prescribed above, and that as you increase
the maximum value of k, the computed result approaches the value of , which we can
nd in many resources, to be as follows (at least to 15 digits of precision). . . )
3.141592653589793
An example of the test le for this programming assignment would be as follows:

 

 

 

 

HERE IS WHAT THE PROGRAM SHOULD LOOK LIKE

 

V:TMP> Prog05
Computing pi Series Summation by ML Formula // KB: This term is easy to check.
============++++++++++=====================
Enter maximum value of k in truncated series (non-negative): 0
Approximation of pi is 4.000000000000000
V:TMP> Prog05
Computing pi Series Summation by ML Formula // KB: disallows negative inputs.
============++++++++++=====================
Enter maximum value of k in truncated series (non-negative): -9
Enter maximum value of k in truncated series (non-negative): -1
Enter maximum value of k in truncated series (non-negative): 1
Approximation of pi is 2.666666666666667
V:TMP> Prog05
Computing pi Series Summation by ML Formula
============++++++++++=====================
Enter maximum value of k in truncated series (non-negative): 50
Approximation of pi is 3.161198612987051
V:TMP> Prog05
Computing pi Series Summation by ML Formula
============++++++++++=====================
Enter maximum value of k in truncated series (non-negative): 100
Approximation of pi is 3.151493401070991
V:TMP> Prog05
Computing pi Series Summation by ML Formula // KB: slowly approaching pi!
============++++++++++===================== // KB: theres a better series!
Enter maximum value of k in truncated series (non-negative): 10000
Approximation of pi is 3.141692643590535
V:TMP>

Subject Computer
Due By (Pacific Time) 09/27/2013 10:00 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy