Horje
how to print numbers with only 2 digits after decimal point in c++ Code Example
how to print numbers with only 2 digits after decimal point in c++
#include <iostream>
#include <iomanip>
#include <iostream>
​
int main()
{
	double d = 122.345;
	cout << fixed << setprecision(2) << d;
  	//the setprecision can vary as per required
}
how to print numbers with only 2 digits after decimal point in c++
#include <cstdio>
#include <iostream>

int main() {
    double total;
    cin>>total;
    printf("%.2f\n", total); 
    //one can use the C function to print the decimal points
}




Cpp

Related
c++ coding structure Code Example c++ coding structure Code Example
shuffle vector c++ Code Example shuffle vector c++ Code Example
C++ Split String By Space into Vector Code Example C++ Split String By Space into Vector Code Example
ue4 c++ enumaeration Code Example ue4 c++ enumaeration Code Example
how to display a variable in c++ Code Example how to display a variable in c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8