Answers for "how to take 3 decimal values from float in c++"

C++
0

print float number with only four places after the decimal point in c++

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
  value = 3.15647;
  std::cout << std::fixed << std::setprecision(2);
  std::cout<<value<<std::endl;
	return 0;
}
Posted by: Guest on March-10-2022
0

Setting a number of decimals on a float on C++

cout.setf(ios::fixed);
cout.precision(2);
Posted by: Guest on July-17-2021

Code answers related to "how to take 3 decimal values from float in c++"

Browse Popular Code Answers by Language