Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void showflags(ios::fmtflags f);
- int main()
- {
- ios::fmtflags f;
- f = cout.flags();
- showflags(f);
- cout.setf(ios::showpos | ios::scientific);
- f = cout.flags();
- showflags(f);
- cout.unsetf(ios::scientific);
- f = cout.flags();
- showflags(f);
- system("pause");
- return 0;
- }
- void showflags(ios::fmtflags f)
- {
- long i;
- cout << "std flag: " << f << " = ";
- for (i = 0x4000; i; i = i >> 1) {
- if (i & f) cout << "1 ";
- else cout << "0 ";
- }
- cout << "n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement