fig11_28.cpp

来自「经典vc教程的例子程序」· C++ 代码 · 共 30 行

CPP
30
字号
// Fig. 11.28: fig11_28.cpp 
// Demonstrating the flags member function.
#include <iostream.h>

int main()
{
   int i = 1000;
   double d = 0.0947628;

   cout << "The value of the flags variable is: "
        << cout.flags()
        << "\nPrint int and double in original format:\n"
        << i << '\t' << d << "\n\n";
   long originalFormat =  
           cout.flags( ios::oct | ios::scientific );
   cout << "The value of the flags variable is: "
        << cout.flags()
        << "\nPrint int and double in a new format\n"
        << "specified using the flags member function:\n"
        << i << '\t' << d << "\n\n";
   cout.flags( originalFormat );
   cout << "The value of the flags variable is: "
        << cout.flags() 
        << "\nPrint values in original format again:\n"
        << i << '\t' << d << endl;
   return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?