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 }

 

 

posted on 2018-07-01 18:28  孙悟空son_ku_kong  阅读(129)  评论(0编辑  收藏  举报

导航