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:

Program 1. Write a program that prints out PI as a type

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!