Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Curency
  6. {
  7. double size;
  8. int code;
  9. double toDoll;
  10. public:
  11. Curency()
  12. :size(0), code(0), toDoll(1)
  13. { }
  14. Curency(double size)
  15. {
  16. this->size = size;
  17. code = 0;
  18. toDoll = 0;
  19. }
  20. Curency(double size, int code, double toDoll)
  21. {
  22. this->size = size;
  23. this->code = code;
  24. this->toDoll = toDoll;
  25. }
  26.  
  27. double getSize()
  28. {
  29. return size;
  30. }
  31. int getCode()
  32. {
  33. return code;
  34. }
  35. double getToDoll()
  36. {
  37. return toDoll;
  38. }
  39.  
  40. void setSize(double size)
  41. {
  42. this->size = size;
  43. }
  44. void setCode(int code)
  45. {
  46. this->code = code;
  47. }
  48. void setToDoll(double toDoll)
  49. {
  50. this->toDoll = toDoll;
  51. }
  52.  
  53. void curInfo()
  54. {
  55. cout << "size = " << size << endl << "code = " << code << endl << "Currency to dollar = " << toDoll;
  56. }
  57.  
  58. void macth(const Curency& other)
  59. {
  60. if (size*toDoll == other.size*other.toDoll) cout << code << " equal to " << other.code;
  61. else if (size*toDoll < other.size*other.toDoll) cout << code << " smaller than " << other.code;
  62. else cout << code << " bigger than " << other.code;
  63. }
  64.  
  65. double inDoll()
  66. {
  67. return size*toDoll;
  68. }
  69.  
  70. double operator + (Curency& other)
  71. {
  72. inDoll() + other.inDoll();
  73. }
  74.  
  75. };
  76.  
  77. int main()
  78. {
  79.  
  80.  
  81. system("pause");
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement