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 emerging technologies will have more injury on our day to day country &amp; How?​
qwelly [4]

Explanation:

Complete the sentence with the words below stop push direction slow down move shape speed up pull A force is a. or a.

4 0
2 years ago
A low concentration of market power has positive affects. A low concentration of market share has which of the following effects
lisov135 [29]
A or b i think hope it helps good luck and i hope it helps
6 0
3 years ago
Write c program to check character is alphabate or not?​
Elan Coil [88]

Lookup the isalpha() function in the C standard library, this function will check and return non-zero for alphabetic characters.

8 0
3 years ago
Alex is nearing graduation. His counselor showed him this information. Alex's College Costs &amp; Payment Options per Year Costs
Pie

Answer:

A

Explanation:

In my opinion, it is best he works the extra $1300 which wouldn't require him to abandon his college plans, wait an extra year or get himself into the trouble of loans.

Cheers

6 0
3 years ago
Read 2 more answers
The development methodology where each part of a project is done in order after each other is called:
Oksanka [162]

Bruh this a duplicate

8 0
3 years ago
Other questions:
  • The email application used by Jim’s office is sending emails with viruses attached to them to user’s computers. What step should
    13·2 answers
  • What is daemontools pakage in qmail?
    14·1 answer
  • When a Firewall is a hardware interface, it is referred as a
    6·1 answer
  • Number 20, can anyone help?
    11·1 answer
  • When writing research questions, use action words, such as
    6·2 answers
  • Is amazon a e-commerce website <br> o true <br> o false
    8·2 answers
  • Which of the following are acceptable to share? Check all of the boxes that apply.
    13·1 answer
  • Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input
    5·1 answer
  • Samantha is part of a project management team working on the initiation phase of a project. What is her team expected to do in t
    5·2 answers
  • An internet ________ is a collection of utility programs designed to maintain your security and privacy while you are on the web
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!