DEV Community

Sanjar Rashidov
Sanjar Rashidov

Posted on

2 2 2 2 2

round()

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

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs