using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication17
{
public partial class Form1 : Form
{
string sayı1;
string islem;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btn1_Click(object sender, EventArgs e)
{
textBox1.Text += btn1.Text;
}
private void btn2_Click(object sender, EventArgs e)
{
textBox1.Text += btn2.Text;
}
private void btn3_Click(object sender, EventArgs e)
{
textBox1.Text += btn3.Text;
}
private void btn4_Click(object sender, EventArgs e)
{
textBox1.Text += btn4.Text;
}
private void btn5_Click(object sender, EventArgs e)
{
textBox1.Text += btn5.Text;
}
private void btn6_Click(object sender, EventArgs e)
{
textBox1.Text += btn6.Text;
}
private void btn7_Click(object sender, EventArgs e)
{
textBox1.Text += btn7.Text;
}
private void btn8_Click(object sender, EventArgs e)
{
textBox1.Text += btn8.Text;
}
private void btn9_Click(object sender, EventArgs e)
{
textBox1.Text += btn9.Text;
}
private void btn0_Click(object sender, EventArgs e)
{
textBox1.Text += btn0.Text;
}
private void btnnokta_Click(object sender, EventArgs e)
{
textBox1.Text += btnnokta.Text;
}
private void btnesit_Click(object sender, EventArgs e)
{
var intSayi1 = Convert.ToInt32(sayı1);
var intSayi2 = Convert.ToInt32(textBox1.Text);
switch (islem)
{
case "carp":
textBox1.Text = (intSayi1 * intSayi2).ToString() ;
break;
case "bol":
textBox1.Text = (intSayi1 / intSayi2).ToString();
break;
case "topla":
textBox1.Text = (intSayi1 + intSayi2).ToString();
break;
case "cıkart":
textBox1.Text = (intSayi1 - intSayi2).ToString() ;;
break;
}
}
private void btnsil_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
}
private void btncarp_Click(object sender, EventArgs e)
{
sayı1 = textBox1.Text;
islem = "carp";
textBox1.Text = "";
textBox2.Text += sayı1 + "*";
}
private void btnbol_Click(object sender, EventArgs e)
{
sayı1 = textBox1.Text;
islem = "bol";
textBox1.Text = "";
textBox2.Text += sayı1 + "/";
}
private void btntopla_Click(object sender, EventArgs e)
{
sayı1 = textBox1.Text;
islem = "topla";
textBox1.Text = "";
textBox2.Text += sayı1 + "+";
}
private void btncıkart_Click(object sender, EventArgs e)
{
sayı1 = textBox1.Text;
islem = "cıkart";
textBox1.Text = "";
textBox2.Text += sayı1 + "-";
}
}
}
Hiç yorum yok:
Yorum Gönder