round()

Sanjar Rashidov - Nov 2 - - Dev Community

Birinchi bo'lib bu funksiyani ishlashi uchun "cmath" kutubxonasi kerak boladi.

round() - bu funksiya kasr sonlarni yaxlitlash uchun ishlatiladi.

Masalan:

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    float kasr1 = 7.7;
    double kasr2 = 77.7;

    cout << round(kasr1) << endl;
    cout << round(kasr2) << endl;

    return 0;
}
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . .