I have a really easy question.
std::cout << std::setprecision(2);
for (int i = 3; i > 0; i--) {
std::cout << i / 3.0 << " ";
}
The above code gives the output:
1 0.67 0.33
Why does i = 3
return an integer number, but i = 2
and i = 1
return a double number? The precision is set to 2
and we are dividing by a double, so I'm confused.