2014

来源:互联网 发布:mac卸载ubuntu双系统 编辑:程序博客网 时间:2024/04/27 16:08
#include <iostream>using namespace std;int main(){    int a=21;    cout.setf(ios::showbase);    cout<<"dec:"<<a<<endl;    cout.unsetf(ios::dec);    cout.setf(ios::hex);    cout<<"hex:"<<a<<endl;    cout.unsetf(ios::hex);    cout.setf(ios::oct);    cout<<"oct:"<<a<<endl;    char *pt="China";    cout.width(10);    cout<<pt<<endl;    cout.width(10);    cout.fill('*');    cout<<pt<<endl;    double pi=22.0/7.0;    cout.setf(ios::scientific);    cout<<"pi=";    cout.width(14);    cout<<pi<<endl;    cout.unsetf(ios::scientific);    cout.setf(ios::fixed);    cout.width(12);    cout.setf(ios::showpos);    cout.setf(ios::internal);    cout.precision(6);    cout<<pi<<endl;    return 0;}
做题做烦了,先体验体验别的吧
0 0