Question
Program 1. Write a program that prints out PI as a type double and a type float EXACTLY as shown below. Your program should have
Program 1. Write a program that prints out PI as a type double and a type float EXACTLY as shown below. Your program should have ONE cout statement within a loop which alters the width and precision each time through the loop. Do not write 10 separate cout statements for this problem. Show the output in a table that increases the precision from 1 to 10 as shown below. Use dash ('-') as the fill character. Note the differences as the precision gets larger. Use the following two variables for PI:
double PI_D = 3.14159256359
float PI_F = 3.14159256359;
please do this in C++
Test output:
C:\Users\dhardin\Desktop\CS121_Spring2020\CS1. DOUBLE FLOAT --3.1 -3.1- -3.14. --3.14 -3.142- --3.142 -3.1416- ---3.1416 -3.14159- --3.14159 --3.141593 -3.141593- -3.1415926------3.1415925 --3.14159256-----3.14159250 -3.141592564----3.141592503 -3.1415925636---3.1415925026 Press any key to continue
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