C++ examples for File Stream:cout
Print 1.234 in a 9-digit field with preceding zeros
#include <iomanip> #include <iostream> #include <limits> int main(int argc, const char *argv[]) { std::cout << std::right << std::setw(9) << std::setfill('0') << 1.234 << std::endl; return 0;//from www . j ava2 s. co m }