#include <iostream> #include <iomanip> #include <string> using namespace std; int main( ) { ios_base::fmtflags flags = cout.flags( ); double pi = 3.14285714; cout << "pi = " << fixed << showpos << setprecision(3) << pi << '\n'; cout.flags(flags); }
pi = +3.143