fork download
  1. #include <string>
  2. #include <algorithm>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. double num = 54.123132232;
  9.  
  10. string num_s = to_string(num);
  11.  
  12. auto point_pos = find(num_s.begin(), num_s.end(), '.');
  13.  
  14. int integral = stol(string(num_s.begin(), point_pos));
  15. int fractal = stoul(string(point_pos + 1, num_s.end()));
  16.  
  17. cout << integral << " " << fractal << endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
54 123132