How To Use Setprecision In Visual Studio Code Example


Example 1: set precision in c++

// setprecision example #include <iostream>     // std::cout, std::fixed #include <iomanip>      // std::setprecision  int main () {   double f =3.14159;   std::cout << std::setprecision(5) << f << '\n';   std::cout << std::setprecision(9) << f << '\n';   std::cout << std::fixed;   std::cout << std::setprecision(5) << f << '\n';   std::cout << std::setprecision(9) << f << '\n';   return 0; }

Example 2: set precision with fixed c++

int x = 109887; cout << fixed << setprecision(3) << x;

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable