jeremyhansen / rooksguide-cplusplus

The Rook's Guide to C++
44 stars 12 forks source link

cout.precision is wrong in Chapter Output #31

Closed ghost closed 7 years ago

ghost commented 8 years ago

include

using namespace std;

int main() { double num = 3.14159265; cout.precision(2); cout << num << endl; }

Prints 3.1 instead of 3.14 since it is using the default floating-point notation.