fork download
  1. #include <cstdint>
  2. #include <cstring>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. void show(double v) {
  7. int8_t b[sizeof(double)];
  8. memcpy(b, &v, sizeof(double));
  9. for (int i = 0; i < sizeof(double); i++) {
  10. cout << (int) b[i] << ", ";
  11. }
  12. cout << endl;
  13. }
  14.  
  15. int main() {
  16. double x;
  17. cin >> x;
  18. double a = x*(1/10.0);
  19. cin >> x;
  20. double b = x/10.0;
  21.  
  22. if(a != b) cout<<"nie jest to dobry sposób"<<endl;
  23.  
  24. show(a);
  25. show(b);
  26. }
Success #stdin #stdout 0s 3432KB
stdin
120
120
stdout
0, 0, 0, 0, 0, 0, 40, 64, 
0, 0, 0, 0, 0, 0, 40, 64,