?? 9_4.cpp
字號:
#include<iostream.h>
int main()
{
int a=30;
long oldf;
float b=3.1415926;
cout.width(5);
oldf=cout.flags(ios::left|ios::hex|ios::showbase|ios::uppercase);
cout<<a<<endl;//輸出a的值
cout.flags(oldf);//恢復(fù)原先設(shè)置
cout.width(5);
cout.fill('#');
cout.setf(ios::internal);
cout.setf(ios::oct|ios::showbase);
cout<<a<<endl;//輸出a的值
cout.fill(' ');
cout.unsetf(ios::internal);//取消設(shè)置
cout.unsetf(ios::oct|ios::showbase);//取消設(shè)置
cout.width(15);
cout.setf(ios::scientific);
cout.setf(ios::showpos);
cout.precision(5);//設(shè)置精度
cout<<b<<endl;
cout.setf(ios::fixed,ios::floatfield);//重新設(shè)置浮點(diǎn)數(shù)輸出形式
cout.unsetf(ios::showpos);//取消設(shè)置
cout.width(10);
cout.precision(6);//設(shè)置精度
cout<<b<<endl;
cout.unsetf(ios::fixed);//取消設(shè)置
cout.setf(ios::showpoint);
cout.width(10);
cout.precision(5);//設(shè)置精度
cout<<b<<endl;
return(0);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -