cout fill(): Specify the fill character : cout fill « Console « C++






cout fill(): Specify the fill character

cout fill(): Specify the fill character
 

#include <iostream>
using namespace std;
int main()
{
  cout.precision(4) ;
  cout.width(10);
  cout << 10.12345 << "\n";
  cout.fill('*');
  cout.width(10);
  cout << 10.12345 << "\n";
  
  cout.width(10);
  cout << "Hi!" << "\n"; 
  cout.width(10);
  cout.setf(ios::left); 
  cout << 10.12345; 
  return 0;
}

           
         
  








Related examples in the same category

1.Using fill() and width for string output
2.Using fill() and width setting for string output
3.Using fill() to set filler for extra space
4.Set fill() for string output
5.Uses ios member functions: setf, ios::hex, ios::basefieldUses ios member functions: setf, ios::hex, ios::basefield