public SComplex Minus(SComplex x) { SComplex y; y.Im = Im - x.Im; y.Re = Re - x.Re; return(y); }
public SComplex Plus(SComplex x) { SComplex y; y.Im = Im + x.Im; y.Re = Re + x.Re; return(y); }
public SComplex Multi(SComplex x) { SComplex y; y.Im = Re * x.Im + Im * x.Re; y.Re = Re * x.Re - Im * x.Im; return(y); }
static void Main(string[] args) { SComplex complex1; complex1.Re = 1; complex1.Im = 2; SComplex complex2; complex2.Re = 3; complex2.Im = 4; #if Plus SComplex result = complex1.Plus(complex2); #elif Multi SComplex result = complex1.Multi(complex2); #elif Minus SComplex result = complex1.Minus(complex2); #endif Console.WriteLine(result.AsString()); Console.ReadKey(); }