fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class TwoNumbers {
  5. const int THOUSAND = 1000;
  6. const int HUNDRED = 100;
  7. const int TEN = 10;
  8. int a, b;
  9.  
  10. public:
  11. TwoNumbers(int a, int b) {
  12. this->a = a;
  13. this->b = b;
  14. }
  15.  
  16. void specialChanging() {
  17. a -= (a / HUNDRED - b % TEN) * HUNDRED;
  18. b -= (b / THOUSAND - a % TEN) * THOUSAND;
  19. }
  20.  
  21. int geta() {
  22. return a;
  23. }
  24.  
  25. int getb() {
  26. return b;
  27. }
  28. };
  29.  
  30. int main() {
  31. int a, b;
  32. cin >> a >> b;
  33. TwoNumbers twoNumbers(a, b);
  34. cout << twoNumbers.geta() << ' ' << twoNumbers.getb() << '\n';
  35. twoNumbers.specialChanging();
  36. cout << twoNumbers.geta() << ' ' << twoNumbers.getb();
  37. return 0;
  38. }
Success #stdin #stdout 0s 5284KB
stdin
601 4001
stdout
601 4001
101 1001