1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Step2247 [10]
3 years ago
13

In C++ 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;
Computers and Technology
1 answer:
victus00 [196]3 years ago
3 0

Answer:

#include<iostream>

#include<iomanip>

using namespace std;

int main()

{

double PI_D = 3.14159256359;

float PI_F = 3.14159256359;

cout<<"i"<<"\t\t"<<"Float"<<"\t\t"<<"Double"<<endl;

for(int i = 1; i<=10;i++)

{

 cout<<i<<"-\t\t"<<PI_F<<setprecision(i)<<"-\t\t"<<PI_D<<setprecision(i)<<endl;

}

 return 0;

}

Explanation:

See Attachment where I used comments for explanation

Download cpp
You might be interested in
Dynamic disk storage provides the flexibility to logically organize disk space across one or more disk drives.
zhuklara [117]
<span>Dynamic disk storage provides the flexibility to logically organize disk space across one or more disk drives. 
a. True 
b. False</span>
3 0
3 years ago
Meaning of sperm count
yulyashka [42]

a measure of the number of spermatozoa per ejaculation or per measured amount of semen, used as an indication of a man's fertility.


5 0
3 years ago
Read 2 more answers
What dose a compress pictures command do ?
Nataliya [291]

Answer: I reduces the size

Explanation: cropped areas of pictures are saved by default, which adds to the file size. If your using PowerPoint then it can reduce the file size by compressing pictures, like lowering their resolution, and deleting cropped areas.

3 0
3 years ago
A credit card can be a good way to pay when yo can’t afford something for a very long time? True or false
scoray [572]
False. Credit cards usually have high interest rates if you don’t pay them off right away. The only way to benefit from a credit card is if you pay it off by the due date monthly.
7 0
3 years ago
How far is florida from oklahoma?
leonid [27]
Florida is 1,344.8 miles from oklahoma
7 0
3 years ago
Read 2 more answers
Other questions:
  • What items should you evaluate when scouting the facilities at a shooting location?
    11·1 answer
  • Which of the following is not a skill set required by data scientists? A. Programming expertise B. Big data expertise C. Telecom
    11·1 answer
  • Analyze the following code. Which of the following statements is correct?
    9·1 answer
  • What could be a summary sentence or phrase that captures your writing experience?
    11·1 answer
  • What can you find the under the privacy policy section of a shopping website?
    12·1 answer
  • In 100 words or less, discuss why ethics is especially important for computer professionals, as it pertains to addressing profes
    5·1 answer
  • Can anyone answer this ​
    12·1 answer
  • Part 2: Code the Program
    12·1 answer
  • It is a data being transported on a network​
    13·1 answer
  • Which actions represent parody?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!