UYGULAMAYI İNDİR
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Kompleks_Sayılar
{
public partial class KompleksSayilar : Form
{
public KompleksSayilar()
{
InitializeComponent();
}
private void KompleksSayilar_Load(object sender, EventArgs e)
{
}
private void radioButtonToplama_CheckedChanged(object sender, System.EventArgs e)
{
TextBoxKontrol();
double a1, a2, b1, b2, a, b;
a1 = Convert.ToDouble(textBox1.Text);
b1 = Convert.ToDouble(textBox2.Text);
a2 = Convert.ToDouble(textBox3.Text);
b2 = Convert.ToDouble(textBox4.Text);
a = a1 + a2;
b = b1 + b2;
labelSonuc.Text = Convert.ToString(a) + "+ i" + Convert.ToString(b);
}
private void radioButtonCikar_CheckedChanged(object sender, System.EventArgs e)
{
TextBoxKontrol();
double a1, a2, b1, b2, a, b;
a1 = Convert.ToDouble(textBox1.Text);
b1 = Convert.ToDouble(textBox2.Text);
a2 = Convert.ToDouble(textBox3.Text);
b2 = Convert.ToDouble(textBox4.Text);
a = a1 - a2;
b = b1 - b2;
labelSonuc.Text = Convert.ToString(a) + "+ i" + Convert.ToString(b);
}
private void TextBoxKontrol()
{
foreach (Control item in this.Controls)
{
if (item is TextBox)
{
if (item.Text.Trim() == "")
{
item.Text = "0";
}
}
}
}
private void radioButtonCarp_CheckedChanged(object sender, EventArgs e)
{
TextBoxKontrol();
double a1, a2, b1, b2, a, b;
a1 = Convert.ToDouble(textBox1.Text);
b1 = Convert.ToDouble(textBox2.Text);
a2 = Convert.ToDouble(textBox3.Text);
b2 = Convert.ToDouble(textBox4.Text);
a = a1 * a2 - b1 * b2;
b = a1 * b2 + b1 * a2;
labelSonuc.Text = Convert.ToString(a) + "+ i" + Convert.ToString(b);
}
private void radioButtonBol_CheckedChanged(object sender, System.EventArgs e)
{
TextBoxKontrol();
double a1, a2, b1, b2, a, b, a1_pay, b1_pay, payda, a2_eslenik, b2_eslenik;
a1 = Convert.ToDouble(textBox1.Text);
b1 = Convert.ToDouble(textBox2.Text);
a2 = Convert.ToDouble(textBox3.Text);
b2 = Convert.ToDouble(textBox4.Text);
a2_eslenik = a2;
b2_eslenik = -b2;
payda = a2 * a2 + b2 * b2;
a1_pay = a1 * a2_eslenik - b1 * b2_eslenik;
b1_pay = a1 * b2_eslenik + b1 * a2_eslenik;
labelSonuc.Text = Convert.ToString(a1_pay / payda) + "+ i" + Convert.ToString(b1_pay / payda);
}
}
}
Hiç yorum yok :
Yorum Gönder