public string Sum(ComplexNum complexNum1, ComplexNum complexNum2) { if (IChecker() == 0) { Answer = complexNum1.Real + complexNum2.Real; Answer1 = complexNum1.Fake + complexNum2.Fake; SAnswer = Answer.ToString() + " + " + Answer1.ToString() + "i"; return(SAnswer); } else { Answer = (complexNum1.Real + complexNum2.Real) + (complexNum1.Fake + complexNum2.Fake) * I; return(Answer.ToString()); } }
public string Multiplication(ComplexNum complexNum1, ComplexNum complexNum2) { if (IChecker() == 0) { int Answer1 = complexNum1.Real * complexNum2.Real; int Answer2 = complexNum1.Real * complexNum2.Fake + complexNum1.Fake * complexNum2.Real; Answer = complexNum1.Fake * complexNum2.Fake * -1; SAnswer = Answer1.ToString() + " + " + Answer2.ToString() + "i" + " + " + Answer.ToString(); return(SAnswer); } if (IChecker() == -1) { Answer1 = complexNum1.Real * complexNum2.Real; int Answer2 = complexNum1.Real * complexNum2.Fake + complexNum1.Fake * complexNum2.Real; Answer = complexNum1.Fake * complexNum2.Fake; SAnswer = Answer1.ToString() + " + " + Answer2.ToString() + "i^2" + " + " + Answer.ToString(); return(SAnswer); } return(SAnswer); }