Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef L4P1_H
- #define L4P1_H
- #include<iostream>
- using namespace std;
- class Complex
- {
- int re, im;
- public:
- Complex()
- {
- re=0;
- im=0;
- }
- Complex(int re, int im)
- {
- this->re = re;
- this->im = im;
- }
- int Complex::egal(Complex c2)
- {
- if((this->re==c2.re)&&(this->im==c2.im))
- return 1;
- else
- return 0;
- }
- void Complex::citire()
- {
- cout<<"Re=";
- cin>>this->re;
- cout<<"\nIm=";
- cin>>this->im;
- }
- };
- #endif
- //main
- #include "l4p1.h"
- int main()
- {
- int x,b;
- Complex c1,c2;
- Complex c3(5,6);
- c1.citire();
- c2.citire();
- x=c1.egal(c2);
- if(x==1)
- cout<<"\nNumerele sunt egale"<<endl;
- if(x==0)
- cout<<"Numerele nu sunt egale";
- cin>>b;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement