Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

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

Step: 3

blur-text-image

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions