Complex Number Addition Function!

Hi everyone, i have 2 different complex number at my class. i want to be collection subtraction multiplication and division. you know. my code is right there! anyone help me =)

//KARMASIK SAYILAR DORT İSLEM
#include <iostream>
using namespace std;

class karmasik_sayi
{
private:
int imajiner;
int reel;
public:
karmasik_sayi()
{
reel=0;
imajiner=0;
};
karmasik_sayi (int x,int y)
{
imajiner=y;
reel=y;
};
karmasik_sayi eslenik();
void yazdir();
};

void karmasik_sayi::yazdir()
{
if(imajiner<0)
{
cout<<reel<<imajiner<<"i";}
else {
cout<<reel<<"+"<<imajiner<<"i";}
}

karmasik_sayi karmasik_sayi::eslenik()
{
karmasik_sayi a;
a.imajiner=imajiner*-1;
a.reel=reel;
return a;
}

karmasik_sayi topla(karmasik_sayi a,karmasik_sayi b)
{
// THIS IS EMPTY
}

karmasik_sayi cikar(karmasik_sayi a,karmasik_sayi b)
{

}
karmasik_sayi carp(karmasik_sayi a,karmasik_sayi b)
{

}

karmasik_sayi bol(karmasik_sayi a,karmasik_sayi b)
{

}
main()
{
karmasik_sayi sayi1(2,2);
sayi1.yazdir();
cout<<"\neslenikk!!!A$agidaYigido\n";
karmasik_sayi sayi1eslenik=sayi1.eslenik();
sayi1eslenik.yazdir();

cout<<"\a\n\nIkinci Karmasik Sayi A$aqid@ Captain\n";
karmasik_sayi sayi2(3,3);
sayi2.yazdir();



cout<<"\n\n\nTOPLAMA ISLEMI"<<endl;
karmasik_sayi topla(karmasik_sayi sayi1,karmasik_sayi sayi2);



}
To add or subtract two complex numbers, just add or subtract the corresponding real and imaginary parts. For instance, the sum of 5 + 3i and 4 + 2i is 9 + 5i.


In other words, something like
karmasik_sayi c( a.reel + b.reel, a.imajiner + b.imajiner );
Topic archived. No new replies allowed.