DEV Community

Mahamadjon000
Mahamadjon000

Posted on

Setprecision

Сегодняшняя тема о setprecision как использовать и что он умеет.

setprecision - это функция которая округляет десятичные числа до точности x цифр.

Чтобы использовать setprecision нужна библиотека iomanip.

C++ обычно отображает числа с плавушей запятой в эксполнциальной записи округления.

Ключевой слова fixed используется чтобы точка должна остаться на своем месте.

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{

float kasrson = 12.33;

cout << setprecision(5) << fixed << kasrson; 


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