#include <iostream>
using namespace std;
int main()
{
ios::fmtflags f;
f = cout.flags();
if(f & ios::showpos)
cout << "showpos is set for cout.\n";
else
cout << "showpos is cleared for cout.\n";
cout << "\nSetting showpos for cout.\n";
cout.setf(ios::showpos);
f = cout.flags();
if(f & ios::showpos)
cout << "showpos is set for cout.\n";
else
cout << "showpos is cleared for cout.\n";
cout << "\nClearing showpos for cout.\n";
cout.unsetf(ios::showpos);
f = cout.flags();
if(f & ios::showpos)
cout << "showpos is set for cout.\n";
else
cout << "showpos is cleared for cout.\n";
return 0;
}
showpos is cleared for cout.
Setting showpos for cout.
showpos is set for cout.
Clearing showpos for cout.
showpos is cleared for cout.