What is the output of program, cout.width(), cout.fill() - C++ File Stream

C++ examples for File Stream:cout

Description

What is the output of program, cout.width(), cout.fill()

Demo Code

#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, const char *argv[]) {
    cout << "12345" << endl; 
    /*from w w w  .  ja v  a2s. c  o  m*/
    cout.width( 5 ); 
    
    cout.fill( '*' ); 
    
    cout << 123 << endl << 123; 

    return 0;
}

Result


Related Tutorials