Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.         double num = 123.45;
  9.         double num2 = 123.4567;
  10.  
  11.         cout << fixed << setprecision(2) << num << endl << num2 << endl;
  12.         return 0;
  13. }
  14.  
  15.  
  16. // output was:
  17. //123.45
  18. //123.46
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement