Programming Language/C++

C++ 실수 mod

hackyu 2019. 9. 25. 20:23
1
2
3
4
5
6
7
8
9
10
11
12
 
#include < iostream >
 
using namespace std;
 
int main() {
    double a = 5.7;
    cout << (int)(a / 5)<< '\n';
    cout << (5.2 - (floor(5.2)) ) + (int)floor(5.2) % 2<< '\n';
 
    return 0;
}
cs