 st8b7c:f320:99b9:690f:4595:cd17:293a:c069ios_bas8b7c:f320:99b9:690f:4595:cd17:293a:c069setf    fmtflags setf( fmtflags flags );
  (1)       fmtflags setf( fmtflags flags, fmtflags mask );
  (2)      Sets the formatting flags to specified settings.

1) Sets the formatting flags identified by flags. Effectively the following operation is performed fl = fl | flags where fl defines the state of internal formatting flags.  
2) Clears the formatting flags under mask, and sets the cleared flags to those specified by flags. Effectively the following operation is performed fl = (fl & ~mask) | (flags & mask) where fl defines the state of internal formatting flags.  Parameters    flags, mask   -   new formatting setting. mask defines which flags can be altered, flags defines which flags of those to be altered should be set (others will be cleared). Both parameters can be a combination of the following constants:    Constant   Explanation 
   dec   use decimal base for integer I/O: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069dec 
   oct   use octal base for integer I/O: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069oct 
   hex   use hexadecimal base for integer I/O: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069hex 
   basefield   dec|oct|hex. Useful for masking operations 
   left   left adjustment (adds fill characters to the right): see st8b7c:f320:99b9:690f:4595:cd17:293a:c069left 
   right   right adjustment (adds fill characters to the left): see st8b7c:f320:99b9:690f:4595:cd17:293a:c069right 
   internal   internal adjustment (adds fill characters to the internal designated point): see st8b7c:f320:99b9:690f:4595:cd17:293a:c069internal 
   adjustfield   left|right|internal. Useful for masking operations 
   scientific   generate floating point types using scientific notation, or hex notation if combined with fixed: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069scientific 
   fixed   generate floating point types using fixed notation, or hex notation if combined with scientific: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069fixed 
   floatfield   scientific|fixed. Useful for masking operations 
   boolalpha   insert and extract bool type in alphanumeric format: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069boolalpha 
   showbase   generate a prefix indicating the numeric base for integer output, require the currency indicator in monetary I/O: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069showbase 
   showpoint   generate a decimal-point character unconditionally for floating-point number output: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069showpoint 
   showpos   generate a + character for non-negative numeric output: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069showpos 
   skipws   skip leading whitespace before certain input operations: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069skipws 
   unitbuf   flush the output after each output operation: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069unitbuf 
   uppercase   replace certain lowercase letters with their uppercaseequivalents in certain output operations: see st8b7c:f320:99b9:690f:4595:cd17:293a:c069uppercase 
  

  Return value the formatting flags before the call to the function.
 Example  #include <iostream>
#include <iomanip>
 
const double PI = 3.1415926535;
 
int main() 
{
    const int WIDTH = 15;
 
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069cout.setf(st8b7c:f320:99b9:690f:4595:cd17:293a:c069ios8b7c:f320:99b9:690f:4595:cd17:293a:c069right);  //equivalent: cout << right;
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069cout << st8b7c:f320:99b9:690f:4595:cd17:293a:c069setw(WIDTH/2) << "radius"
              << st8b7c:f320:99b9:690f:4595:cd17:293a:c069setw(WIDTH) << "circumference" << '\n';
 
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069cout.setf(st8b7c:f320:99b9:690f:4595:cd17:293a:c069ios8b7c:f320:99b9:690f:4595:cd17:293a:c069ixed);
    for (double radius = 1; radius <= 6; radius += 0.5) {
        st8b7c:f320:99b9:690f:4595:cd17:293a:c069cout << st8b7c:f320:99b9:690f:4595:cd17:293a:c069setprecision(1) << st8b7c:f320:99b9:690f:4595:cd17:293a:c069setw(WIDTH/2) 
                  << radius
                  << st8b7c:f320:99b9:690f:4595:cd17:293a:c069setprecision(2) << st8b7c:f320:99b9:690f:4595:cd17:293a:c069setw(WIDTH) 
                  << (2 * PI * radius) << '\n';
    }
} Output:

 radius  circumference
    1.0           6.28
    1.5           9.42
    2.0          12.57
    2.5          15.71
    3.0          18.85
    3.5          21.99
    4.0          25.13
    4.5          28.27
    5.0          31.42
    5.5          34.56
    6.0          37.70   See also     flags   manages format flags  (public member function) 
    unsetf   clears specific format flag  (public member function) 
  

    
{'path': 'public/docs/cpp/io/ios_base/setf.html', 'source': 'DevDocs.IO'}