You are on page 1of 1

#include <iostream>

#include<math.h>

using namespace std;

class NrComplex
{
private:
double re;
double im;
public:
NrComplex(double, double);
friend double abs(NrComplex&);
void afisare();
};

NrComplex::NrComplex(double Re, double Im)


{
re = Re; im = Im;
}
double abs(NrComplex&z)
{return sqrt(z.re*z.re + z.im*z.im); }

void NrComplex::afisare()
{
cout<<"\n Numarul Complex Z = "<<re <<" +i"<<im;
}

int main()
{
NrComplex z2(5,7);
z2.afisare();
cout<<"\nNorma Liu z2 ="<<abs(z2);
return 0;
}

You might also like