Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program that will generate the nber PI to the user with defined decimal places. NO ROUNDING. PI is estimated as 3.1415926535897932. When
Write a C++ program that will generate the nber PI to the user with defined decimal places. NO ROUNDING. PI is estimated as 3.1415926535897932.
When you run/execute the program 1. The user will be prompted to enter a number between 1 and 16, anything else the program exit displaying message stating not valid input. 2. If the input is valid, the program will display the exact decimal places the user entered, for example: If the user entered 5 decimal places the output should be: 3.14159 not 14169 Also If the user entered 4 decimal places the output should be: 3.1415 not 31416 Notes 1. Make sure you use proper variable and constant declaration. 2. If the program is not outputting the correct result no credit will be given Ref: e https://www.google.com/search?g-Pl+&ie-utf-8&oe-utf-8 https://en.wikipedia.org/wiki/Pi e http://www.pidav.org/million Extra Directions: 1. Using printf(print format) and/or setprecision (n) will not work since it will round, and if you round no credit will be given don't use switch statement to iterate through the user selection (from 1 to 16), this is not acceptable see below code snip (you should not use something like this in your code): switch (position) 2. case 1: userSelectPI3.1; break; case 2: userSelectPI3.14; break; case 3: userSelectPI3.141; break; case 4: 3. Make sure your code compile and run to get credit, no partial credit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started