#include #include #include using namespace std; int main() { double d = 6.66666666666666; //15 digits, including 1 to left of decimal ios_base::fmtflags save = cout.flags(); streamsize prec = cout.precision(); cout << "The default precision is " << prec << ".\n"; cout << d << "\n" //printf("%g", d); << setprecision(3) << d << "\n" //printf("%.3g", d); << fixed << d << "\n" //printf("%.3f", d); << scientific << d << "\n" //printf("%.3e", d); << resetiosflags(ios_base::floatfield)<