C++ round()

1 개요[ | ]

C++ round()
C++
Copy
#include <iostream>
#include <cmath>
using namespace std;
int main() {
    cout << round(3.14159) << endl; // 3
}
Loading
C++
Copy
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
    cout << setprecision(3) << 3.14159 << endl; // 3.14
    cout << setprecision(5) << 123.56789 << endl; // 123.57
}
Loading

2 같이 보기[ | ]

3 참고[ | ]