double a=3;                      //一定是double不能是int

cout.setf(ios::fixed);
cout.precision(2);

cout<<a<<endl;

 

 

输出:3.00

posted on 2015-04-23 19:23  三人纷纷  阅读(1222)  评论(0编辑  收藏  举报