146k views
0 votes
Write a single statement that prints outsideTemperature with 2 digits in the fraction (after the decimal point). End with a newline.

#include
#include
#include
using namespace std;

int main() {
double outsideTemperature = 103.45632;

/* Your solution goes here */

return 0;
}

1 Answer

6 votes

Answer:

cout << fixed << setprecision(2) << outsideTemperature << endl;

Step-by-step explanation:

We need to use fixed and setprecision()

fixed allows to write the values in fixed point notation.

setprecision() allows us to specify how many digits we want in the value

In order to create a new line, endl must be added at the end

User MikePR
by
6.3k points