Guest User

Untitled

a guest
Jun 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. class CInt55 {
  2. private:
  3. int liczba;
  4. public:
  5. CInt55(int parametr=0) {
  6. liczba = parametr%55;
  7. }
  8.  
  9. void operator=(int liczba) {
  10. this->liczba = liczba%55;
  11. }
  12.  
  13. void rownasie(int liczba) {
  14. this->liczba = liczba%55;
  15. }
  16.  
  17. CInt55& operator*(CInt55 c) {
  18. CInt55 temp(this->liczba * c.liczba);
  19. return temp;
  20. }
  21.  
  22. friend void operator=(CInt55, int);
  23. friend void operator<<(ostream&, CInt55&);
  24. friend ostream& operator<<(ostream&, CInt55&);
  25. };
  26.  
  27. void operator=(CInt55 a, int b) {
  28. a.liczba = b%55;
  29. }
  30.  
  31. void operator<<(ostream &wyjscie, CInt55 &d) {
  32. wyjscie << d.liczba;
  33. }
  34.  
  35. ostream& operator<<(ostream &wyjscie, const CInt55 &d) {
  36. return wyjscie << d.liczba;
  37. }
  38.  
  39. int main() {
  40. CInt55 a(0);
  41. CInt55 b(60);
  42. CInt55 c;
  43. c = a*b;
  44. cout << c;
  45. return 0;
  46. }
Add Comment
Please, Sign In to add comment