showflag.cpp
上传用户:dq031136
上传日期:2022-08-08
资源大小:802k
文件大小:1k
- #include <iostream.h>
- void showflags(void);
- void main(void)
- {
- showflags();
- cout.setf(ios::right | ios::showpoint | ios::fixed);
- showflags();
- }
- void showflags(void)
- {
- long flag_set, i;
- int j;
- char flags[15][12] = {
- "skipws", "left", "right", "internal", "dec",
- "oct", "hex", "showbase", "showpoint", "uppercase",
- "showpos", "scientific", "fixed", "unitbuf",
- };
- flag_set = cout.flags();
- for (i=1, j=0; i<0x2000; i = i<<1, j++)
- if (i & flag_set)
- cout << flags[j] << " is on." << endl;
- else
- cout << flags[j] << " is off." << endl;
- cout << endl;
- }