Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These are the instructions that my professor gave us for the assignment: Write a C++ program to compute the value of PI based upon the

These are the instructions that my professor gave us for the assignment:

Write a C++ program to compute the value of PI based upon the Gregory-Leibniz Series given the number in the series.

2. Accept the sequence number from the user (as an integer). (5 points) 3. Do not allow the program to continue until the sequence number selected by the user is positive (at least 1). (5 points). 4. Compute and print the value of PI using the Gregory-Leibniz Series up to the sequence number entered by the user (35 points)

Sample Runs:

Welcome to the compute PI program... What is the sequence number?-9 What is the sequence number? (must be an integer > 0)0 What is the sequence number? (must be an integer > 0)-6 What is the sequence number? (must be an integer > 0)30000 3.141559320256469190054890439078860708832508

Welcome to the compute PI program... What is the sequence number?65 3.156976358911272252617472022784284035878954

Welcome to the compute PI program... What is the sequence number?1000000 3.14159165358979318525417534502253147365991

I set up the code and have gotten all of it right except that when I run my program, the answer doesn't show as much decimal places as my professor's sample runs do. For example, when I input the sequence number as 65, my answer is 3.14156 not the full answer my professor has. I tried using showpoint << setprecision (seqnum) but it didn't work. Help?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago