Set showpos flag for double
#include <iostream> using namespace std; int main() { int x = 100; double f = 98.6; double f2 = 123456.0; double f3 = 1234567.0; // Set the showpos flag. cout.setf(ios::showpos); cout << "Setting showpos flag.\n"; cout << "f in default notation after setting showpos: " << f << "\n\n"; return 0; }