Logaritmalı Hesap Makinesi C#.NET(C.NET)

logaritmalı Hesap Makinesi C#.NET(C.NET)…

log
[code=’Csharp’]
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
button2.Click += new EventHandler (button1_Click);
button3.Click += new EventHandler(button1_Click);
button4.Click += new EventHandler(button1_Click);
button5.Click += new EventHandler(button1_Click);
button6.Click += new EventHandler(button1_Click);
button7.Click += new EventHandler(button1_Click);
button8.Click += new EventHandler(button1_Click);
button9.Click += new EventHandler(button1_Click);
button10.Click += new EventHandler(button1_Click);
button11.Click += new EventHandler(button1_Click);
button12.Click += new EventHandler(button1_Click);
label3.Text = DateTime.Now.ToLongDateString();

}

private void button1_Click(object sender, EventArgs e)
{
decimal sonuç = 0, sayı1 = 0, sayı2 = 0;
try
{
sayı1=decimal.Parse(textBox1.Text);
sayı2=decimal.Parse(textBox2.Text);
switch((sender as Button).Text)
{
case “+” : sonuç=sayı1+sayı2;break;
case “*” : sonuç=sayı1*sayı2;break;
case “-” : sonuç=sayı1-sayı2;break;
case “/” : sonuç=sayı1/sayı2;break;
case “Long”: sonuç = (decimal) Math.Log10((double) sayı1);break;
case “Ln” : sonuç = (decimal) Math.Log((double) sayı1);break;
case “Sin” : sonuç = (decimal) Math.Sin((double) sayı1);break;
case “Cos” : sonuç = (decimal) Math.Cos((double) sayı1);break;
case “Tan” : sonuç = (decimal) Math.Tan((double) sayı1);break;
case “Kök” : sonuç = (decimal) Math.Pow((double) sayı1 ,(double)(1/sayı2));break;
case “Üst” : sonuç = (decimal) Math.Pow((double) sayı1 ,(double)sayı2);break;
}
textBox3.Text=sonuç.ToString();
}
catch(System.DivideByZeroException hata)
{
MessageBox.Show(“sıfıra bölmeye çalışıyorsun.rn”+ hata.Message);
}catch(System.OverflowException hata)
{
if (sayı1<0) MessageBox.Show("negatif sayıyla bu işlemi yapamazsınız.rn"+ hata.Message); else MessageBox.Show("Sayılar çok büyükrn"+ hata.Message); } catch(System.FormatException hata) { MessageBox.Show("Sayı girmediniz.rn"+hata.Message); } catch(Exception hata) { MessageBox.Show("Bilinmeyen bir hata oluştu.rn"+hata.Message); } } private void button13_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; } private void button14_Click(object sender, EventArgs e) { this.Close(); } private void label3_Click(object sender, EventArgs e) { } }[/code]

Projeyi İNDİR

 

Yorumlar 2

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir