Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void showflags(ios::fmtflags f);
  5.  
  6. int main()
  7. {
  8. ios::fmtflags f;
  9.  
  10. f = cout.flags();
  11. showflags(f);
  12.  
  13. cout.setf(ios::showpos | ios::scientific);
  14. f = cout.flags();
  15. showflags(f);
  16.  
  17. cout.unsetf(ios::scientific);
  18. f = cout.flags();
  19. showflags(f);
  20.  
  21. system("pause");
  22. return 0;
  23. }
  24.  
  25. void showflags(ios::fmtflags f)
  26. {
  27. long i;
  28.  
  29. cout << "std flag: " << f << " = ";
  30. for (i = 0x4000; i; i = i >> 1) {
  31. if (i & f) cout << "1 ";
  32. else cout << "0 ";
  33. }
  34. cout << "n";
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement