C++学习(35)

 1 //分别用十进制、十六进制和科学计数法格式输出3个数
 2 //使用操作符
 3 #include<iostream.h>
 4 int main(){
 5     int count=432;
 6     int state=1234;
 7     float x=555.55;
 8 
 9     //cout.setf(ios::dec);
10     cout<<"count="<<dec<<count<<endl;
11 
12     //cout.setf(ios::hex);
13     cout<<"state="<<hex<<state<<endl;
14     
15     cout.setf(ios::scientific);
16     cout<<"x="<<x<<endl;
17     return 0;
18 }

猜你喜欢

转载自www.cnblogs.com/Tobi/p/9250830.html