lahlousara200 lahlousara200
  • 13-03-2021
  • Computers and Technology
contestada

Write a cout statement so the variable sales is displayed with a precision of three decimal places, with the decimal point always displayed.

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 18-03-2021

Answer:

The statement is as follows:

cout <<fixed<< setprecision(3) <<sales;

Explanation:

Here, I assume that the variable has already been declared.

The syntax to use is:

cout<<fixed<<setprecision(n)<<variable-name;

In this case:

[tex]n = 3[/tex] --- i.e. to 3 decimal places

And the variable name is: sales

So, when implemented, the instruction is:

cout <<fixed<< setprecision(3) <<sales;

Answer Link

Otras preguntas

what does it mean by "superimpose the regression line on the scatter plot" ??
What decimal is 1/10 of 0.08?
A polis of ancient Greece was a __________. A politically independent unit that included a city and surrounding land B colony controlled by the country that es
Keelah’s Clothing Store buys coats for $50 and then sells them for $80. What is the percent of mark up on the price of the coat? ​
why can many ecosystems exist in one biome
Decrease £1200 by 25%
How does the amendment process reflect the idea of democracy?
what kind of countries existed in ancient greece
what is 14% as a decimal
If We Start With 400 Atoms of a Radioactive Substance, How Many Would Remain After One Half-life ?