Guest User

Untitled

a guest
Jun 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. using namespace std;
  4.  
  5. void main()
  6. {
  7. double nmb;
  8.  
  9. cin >> nmb;
  10.  
  11. // Кол-во чисел после запятых равно:
  12.  
  13. cout << (nmb - (int)nmb) << endl;
  14.  
  15. // Само число равно
  16.  
  17. while (nmb - (int)nmb != 0)
  18. {
  19. cout << nmb << endl;
  20. nmb *= 10;
  21. }
  22.  
  23. cout << "Result number is " << nmb << endl;
  24.  
  25. system("pause");
  26. }
  27.  
  28. int fractional_part_as_int(double number, int number_of_decimal_places) {
  29. double dummy;
  30. double frac = modf(number,&dummy);
  31. return round(frac*pow(10,number_of_decimal_places));
  32. }
Add Comment
Please, Sign In to add comment