Untitled


SUBMITTED BY: antoineh1

DATE: May 8, 2016, 2:10 p.m.

FORMAT: Text only

SIZE: 2.4 kB

HITS: 4709

  1. #include <iostream>
  2. #include <string>
  3. #include <cstring>
  4. using namespace std;
  5. class Vraboten
  6. {
  7. protected:
  8. string ime;
  9. int plataChas;
  10. int chasovi;
  11. public:
  12. Vraboten(string i=" ", int pc=0, int c=0)
  13. {
  14. ime=i;
  15. pc=plataChas;
  16. chasovi=c;
  17. }
  18. Vraboten(const Vraboten &v)
  19. {
  20. ime=v.ime;
  21. plataChas=v.plataChas;
  22. chasovi=v.chasovi;
  23. }
  24. int isplati()
  25. {
  26. cout<<plataChas*chasovi<<endl;
  27. return (plataChas*chasovi);
  28. }
  29. Vraboten &operator++()
  30. {
  31. plataChas++;
  32. return *this;
  33. }
  34. friend ostream &operator<<(ostream &out, Vraboten &v)
  35. {
  36. out<<v.ime<<" "<<v.plataChas<<" "<<v.chasovi<<endl;
  37. return out;
  38. }
  39. friend bool operator==(Vraboten &v1, Vraboten &v2)
  40. {
  41. return (v1.isplati()==v2.isplati());
  42. }
  43. };
  44. class Menadzer:public Vraboten
  45. {
  46. protected:
  47. Vraboten vraboteni[1000];
  48. int br_vraboteni;
  49. public:
  50. Menadzer(string i=" ", int pc=0, int c=0, int brv=0, Vraboten *v=NULL):Vraboten(i, pc, c)
  51. {
  52. br_vraboteni=brv;
  53. for(int i=0;i<br_vraboteni;i++)
  54. {
  55. vraboteni[i]=v[i];
  56. }
  57. }
  58. int isplati()
  59. {
  60. cout<<Vraboten::isplati()+br_vraboteni*5*plataChas<<endl;
  61. return Vraboten::isplati()+br_vraboteni*5*plataChas;
  62. }
  63. Menadzer &operator+=(Vraboten &v)
  64. {
  65. if(br_vraboteni<1000)
  66. {
  67. vraboteni[br_vraboteni++]=v;
  68. return *this;
  69. }
  70. }
  71. };
  72. class Inzener:public Vraboten
  73. {
  74. protected:
  75. string proekti[100];
  76. int br_proekti;
  77. public:
  78. Inzener(string i=" ", int pc=0, int c=0, int brp=0, string *p=NULL):Vraboten(i, pc, c)
  79. {
  80. br_proekti=brp;
  81. for(int i=0;i<br_proekti;i++)
  82. {
  83. proekti[i]=p[i];
  84. }
  85. }
  86. int isplati()
  87. {
  88. cout<<Vraboten::isplati()+0.1*Vraboten::isplati()*br_proekti<<endl;
  89. return (Vraboten::isplati()+0.1*Vraboten::isplati()*br_proekti);
  90. }
  91. Inzener &operator+=(string p)
  92. {
  93. if(br_proekti<100)
  94. {
  95. proekti[br_proekti++]=p;
  96. return *this;
  97. }
  98. }
  99. };
  100. int main()
  101. {
  102. cout << "Hello world!" << endl;
  103. return 0;
  104. }

comments powered by Disqus