如何对结果小数进行四舍五入

从键盘输入两个数a和b(b不等于0),令a除以b的值等于c,计算c的值。将c的值在小数点后两位处进行四舍五入(例如,c=3.16,四舍五入后为3.2;c=3.12,四舍五入后为3.1),输出c的值(显示到小数点后两位)。


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    float a,b;
    cin>>a>>b;
    float c = a/b;
    c = round(c*10)/10;
    cout<<c;
    return 0;
}

img