Set and Unset Format Flags to IO streams

This video tutorial explains how to set format flags to specific io streams in c++ programming.
You will learn what are the format flags available, how to set format flags using setf function to a stream, how to use flags function to set multiple flags to a stream, how to unset flags using unsetf function, which format flags are available from IOS class in detail with examples.

source code for this tutorial

#include <iostream>

using namespace std;

// formatflags setf(formatsflans flag);

int main()
cout.setf(ios :: showpos , ios :: showpoint);
cout.unsetf(ios :: showpos);
auto flag = ios :: showpos | ios :: showpoint | ios :: showbase;
cout << 100.2 <<endl;
cout << -65.3 <<endl;
cout << 89.8<<endl;
return 0;

Back To Top