//flt.cpp // floating point output #include #include using namespace std; int main() { float x, y; x = 12.3456; y = 222; cout << x << endl; //without formatting cout << y << endl; cout << setiosflags(ios::fixed | ios::showpoint) << setprecision(2); cout << x << endl; //with formatting cout << y << endl; return 0; } /* Output: 12.3456 222 12.35 222.00 */