DEV Community

Sanjar Rashidov
Sanjar Rashidov

Posted on

2 2 2 2 2

setprecision()

Bu funksiya uchun "iomanip" kutubxonasi kerak boladi.

setprecision(x) - bu funksiya kasr sonlarni nuqtadan keyin x ta raqam aniqlikda yaxllitlaydi. ushbu funksiya aytilgan aniqlikda yaxlitlaydi.

C++ odatda float sonlarni yaxlitlagandan keyin ilmiy ko'rinishda ko'rsatadi. Buni togirlash uchun "fixed" kalit so'zi ishlatiladi.

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{

    float kasr = 77.77;

    cout << setprecision(1) << fixed << kasr; 

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more