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
Using Turtle Graphics, write a program that will produce 2 Zs next to each other. It is irrelevant where these Zs appear and wha
LekaFEV [45]

Answer:

# import the  turtle library

from turtle import *

# create a turtle space

space = Screen()

# create a turtle object

z = Turtle()

 

# create a single Z

z.forward(50)

z.right(120)

z.forward(100)

z.left(120)

z.forward(50)

 

# adjust the turtle position

z.up()

z.left...

Explanation:

8 0
3 years ago
When somthing is trustworthy we call it what?
Gnom [1K]

Answer:

dependable

Explanation:

5 0
3 years ago
Read 2 more answers
Where could identity theft access your personal information?
riadik2000 [5.3K]
From hacking into public websites where you pay and stuff, or put in a fake official window to lure out your private info.
6 0
3 years ago
Read 2 more answers
Question 7 of 25
Vika [28.1K]

Explanation:

the right answer may be A.

5 0
2 years ago
Match the spacing options to their meanings.
Maslowich

Before text = indents paragraph to the right  

First line = indents the start of a paragraph

Register-true = formats page styles  

Line spacing = manages space between two lines  

The first line always gets indent to specify that it is a start of the paragraph

Line spacing always focus on the number of spaces between lines. There are various values available to give spacing according to the need. Register- true is used to format all the page styles and do other related configurations.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Mark, David, Tia, and Ashley are team members in a computer programming class. They have been assigned the task of creating a co
    12·1 answer
  • ________ are websites that provide collections of content from all over the world wide web a. aggregators b. social networks c.
    6·1 answer
  • Implement RandMultipByVal function, which gets one integervariable as its argument
    12·1 answer
  • Which term means a device that converts one voltage to another?
    13·1 answer
  • A detective agency is looking to bust an arms sale. According to available intelligence, the sale is likely to happen in one of
    11·1 answer
  • You're the sole IT employee at your company, and you don't know how many users or computers are in your organization. Uh oh! Wha
    8·1 answer
  • what is one example of the decomposers taking from the ecosystem and one of them giving to the ecosystem
    14·1 answer
  • Nathan has a 30-second clip of music that he wants to play over and over again when he runs a program. What does Nathan need to
    5·2 answers
  • The Freeze Panes feature would be most helpful for which situation?
    6·1 answer
  • Choose the correct line of code.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!