Mega Code Archive

 
Categories / C++ Tutorial / Development
 

Show default condition of format flags

#include <iostream> using namespace std; void showflags() ; int main() {      showflags();   cout.setf(ios::right | ios::showpoint | ios::fixed);   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"; } 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 0 1 1 0