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
Which value can be entered to cause the following code segment to display the message "That number is acceptable."? ____.
vaieri [72.5K]

Answer:

C) 99

Explanation:

This code only displays "That number is acceptable" when such number is higher than 10 and less than 100. This is  becasue the conditional sentence <em>if </em>controls which message is going to be displayed based on the abovementioned condition. 0 and 10 are not greater than 10, so they don't pass the condition and 100 is not less than itself, so it does not pass either. The only number among the options greater than 10 and less than 100 is 99.

8 0
3 years ago
Which of the following is not a skill set required by data scientists? A. Programming expertise B. Big data expertise C. Telecom
ziro4ka [17]

Answer:

Explanation:Option C is the correct answer.

8 0
3 years ago
Ned and Mary Ann are saving their files to a CD. When prompted, Ned will click on Burn file to disk, indicate the recording spee
r-ruslan [8.4K]

Answer:

Should be Ned.

5 0
3 years ago
Which is a benefit of owning a desktop computer instead of a laptop?
Setler79 [48]
B) a desktop is less likely to be stolen or damaged
4 0
4 years ago
Read 2 more answers
Complete the following sentences using each of the words provided ONCE only. KEYBOARD DESKTOP STORE PRINTER COMPUTER MOUSE MONIT
WARRIOR [948]

Answer:

Explanation:

Monitor is an electronic device that retrieves, and processes shows you what is going on in the computer.

Desktop is the first image you see on your screen when the computer is is used for telling the computer what to do.

keyboard

is used for typing documents. Printer is used for putting documents on paper. CD Bay you can insert a CD or Compact Disc. is is box inside and shaped

8 0
2 years ago
Other questions:
  • With a _____ network connection, the computers and other devices on the network are physically connected via cabling to the netw
    10·2 answers
  • What must you do first in order to change the font type size and colour of a particular text
    13·2 answers
  • A superscope is a special type of scope that allows a dhcp server to service multiple ipv4 subnets on multiple physical networks
    7·1 answer
  • All of the following are strategies to help you prepare for standardized test except <br>​
    5·1 answer
  • Do you think that distributed OSs use a process-communication technique different from that used by desktop OSs?
    13·1 answer
  • 100 tickets are sold in a raffle with one prize. John has 8 tickets, Jamie has 10 tickets, find the probability that John wins
    11·2 answers
  • Which is a benefit of peer-to-peer networking?
    12·1 answer
  • HELP 20 points THIS IS ON EDGE IF YOU DON'T KNOW THE ANSWER DON'T RESPOND
    12·2 answers
  • Which bits of the address would be used in the tag, index and offset in a two-way set associative cache with 1-word blocks and a
    7·1 answer
  • As part of your regular system maintenance, you install the latest operating system updates on your Windows 10 computer. After s
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!