CHAPTER2-4.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
源码类别:

STL

开发平台:

C/C++

  1. //文件名:CHAPTER2-4.cpp
  2. #include<iostream.h>
  3. #include<iomanip.h>
  4. void main()
  5. {
  6. int  i=63;
  7. float  pai=3.14;
  8. cout.setf(ios::hex,ios::basefield);
  9. cout.setf(ios::showbase);
  10. cout<<i<<endl;
  11. cout.unsetf(ios::showbase);
  12. cout<<i<<endl;
  13. cout.setf(ios::uppercase);
  14. cout<<i<<endl;
  15. cout.setf(ios::showpoint);
  16. cout<<pai<<endl; //显示3.14000
  17. cout.setf(ios::scientific,ios::floatfield);
  18. cout<<pai<<endl; //显示3.140000E+000
  19. cout.setf(ios::left,ios::adjustfield);
  20. cout.width(10);
  21. cout.fill('¥');
  22. cout<<"%%%"<<endl; //显示"%%%¥¥¥¥¥¥¥"
  23. }