C++学习(34)

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

猜你喜欢

转载自www.cnblogs.com/Tobi/p/9250826.html
今日推荐