#include <iostream>
using namespace std;
void showflags();
int main()
{
// show default condition of format flags
showflags();
// showpos, showbase, oct, right are on, others off
ios::fmtflags f = ios::showpos | ios::showbase | ios::oct | ios::right;
cout.flags(f);
showflags();
return 0;
}
void showflags()
{
ios::fmtflags f;
long i;
f = cout.flags(); // get flag settings
// check each flag
for(i=0x4000; i; i = i >> 1)
if(i & f) cout << "1 ";
else cout << "0 ";
cout << " \n";
}
|