Advertisement
Guest User

1111

a guest
Oct 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <exception>
  3. using namespace std;
  4. class Chislo
  5. {
  6. int x;
  7. int y;
  8. public:
  9. Chislo() {}
  10. Chislo(int a, int b) : x(a), y(b)
  11. {}
  12.  
  13. const int get_1()
  14. {
  15.  
  16. return x;
  17.  
  18. }
  19.  
  20. const int get_2()
  21. {
  22.  
  23. return y;
  24.  
  25. }
  26.  
  27. const void setData(int iks, int igrek)
  28. {
  29.  
  30. x = iks;
  31. y = igrek;
  32. }
  33.  
  34. const int print()
  35. {
  36. try
  37. {
  38. if (y == 0)
  39. {
  40. throw 1;
  41. }
  42. return (x / y);
  43. }
  44. catch (int i)
  45. {
  46.  
  47. cout << "ERROR: Znamenatel' =0";
  48.  
  49. }
  50. }
  51. };
  52.  
  53. int main()
  54. {
  55.  
  56. int a, b;
  57. cin >> a >> b;
  58. Chislo data(a,b);
  59. cout << data.print();
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement