C/C++で四捨五入

小数を整数に四捨五入する場合。

#include <math.h>

...

double x = 5.5674; // 例
double round_x;

round_x=floor(x*100+0.5)/100;

...

floor()は 入力値以下の最大の整数値を計算する関数。

参考