Advertisement
Gireada

POO P4.1

Apr 5th, 2017
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Complex
  6. {
  7.     int a, b;
  8.     public:
  9.         Complex() { b = 2; }
  10.         Complex(int a, int b)
  11.         {
  12.             this->a = a;
  13.             this->b = b;
  14.         }
  15.         int egal(Complex c2);
  16.  
  17. };
  18.  
  19. int Complex::egal(Complex c2)
  20. {
  21.     this->a = a;
  22.     this->b = b;
  23.     if (a == b)
  24.         return 1;
  25.     else
  26.         return 0;
  27. }
  28.  
  29. int main()
  30. {
  31.     Complex c1(2, 2);
  32.     Complex c3;
  33.     cout<<c1.egal(c1);
  34.     system("pause");
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement