1.常规方法(C++):

cout << fixed << setprecision(x) <<a;

2.c语言输出(保留2位小数输出):

printf("%0.2f",f);

2 comments

  • 1