#include <iostream>
#include <math.h>
using namespace std;
double Ceiling(double x);
double Flooring(double x);
double Rounding(double x);
int main()
{
double x;
cout.setf(ios::left);
cout.setf(ios::fixed);
cout.precision(2); // 소수2번째자리까지 출력
cout<<"Enter the floating-point number : ";
cin>>x;
cout<<"ceiling : "<<Ceiling(x) << endl; //ceiling함수값 출력
cout<<"Flooring : "<<Flooring(x)<<endl; //floor함수값 출력
cout<<"Rounding : " <<Rounding(x)<<endl; //Rounding함수값 출력
return 0;
}
double Ceiling(double x)
{
x = x + 0.009;
x = (int)(x * 100); // 인트로 형변환함으로써 맨뒷자리 한자리버림
x = (double)(x / 100);
return x;
}
double Flooring(double x)
{
x = (int)(x*100); // 인트로 형변환함으로써 맨뒷자리 한자리버림
x = (double)(x / 100);
return x;
}
double Rounding(double x)
{
x = x + 0.005;
x = (int)(x*100); // 인트로 형변환함으로써 맨뒷자리 한자리버림
x = (double)(x / 100);
return x;
}