Print 1.234 in a 9-digit field with preceding zeros - C++ File Stream

C++ examples for File Stream:cout

Description

Print 1.234 in a 9-digit field with preceding zeros

Demo Code

#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
}

Result


Related Tutorials