em tạo class số phức khi build nó báo lỗi LNK 2019 mà em không biết sai ở đâu.
các bác giúp em tìm lỗi với ạ!
code:
#include<iostream>
#include<cmath>
using namespace std;
class Complex
{
private:
double re, im;
public:
Complex()
{
re = 0;
im = 0;
}
Complex(double r, double i)
{
r = re;
i = im;
}
void Nhap()
{
cout << "\nNhap so phuc:\n";
cout << "Re = "; cin >> re;
cout << "Im = "; cin >> im;
}
void Xuat()
{
cout << "(" << re << " + " << im << "i)";
}
Complex operator+ (Complex C)
{
Complex C1;
C1.re = this->re + C.re;
C1.im = this->im + C.im;
return C1;
}
Complex operator- (Complex C)
{
Complex C1;
C1.re = this->re - C.re;
C1.im = this->im - C.im;
return C1;
}
Complex operator* (Complex C)
{
Complex C1;
C1.re = this->re * C.re - this->im * C.im;
C1.im = this->re * C.im + this->im * C.re;
return C1;
}
Complex operator/ (Complex C)
{
Complex C1;
C1.re = (this->re * C.re + this->im * C.im) / (pow(C.re, 2) + pow(C.im, 2));
C1.im = (this->im * C.re - this->re * C.im) / (pow(C.re, 2) + pow(C.im, 2));
return C1;
}
};