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

Which of the following topics would lend itself only to a formal style of writing? a. How I Lost 10 Pounds b. Folk Songs I Have Sung c. Why Living in the Cou
In relation to the U.S. Constitution, a concurrent power is which of the following
round to the nearest thousands 78,600
Another wildfire spread for 7 days and covered a total of 780 square miles. How can you estimate the number of square miles the fire covered per day?
Which belongs in the blank space of the chemical equation for the burning of fossil fuels below? Fossil fuel + oxygen gas  _________ + water + heat
(5 hundreds 5 tens)×10 in unit form what's the unit form?
Evaluate 3 squared times 3 cubed
Decimals greater than 7.0 but less than 13.0 use an interval of 0.6 between each pair of decimals
Given f(x) = x + 11 and g(x) = x - 7, what is f(x) + g(x)? -77x 18x 2x + 4 -2 - 77x
What is the Factor tree of 73