Webmaster Destek Forumu

Yarınların için bir şey yapmazsan, ölene dek Alarm kurmaya mahkumsun !
İletişim
  • Duyuru; Sizde hemen Üye Olup Sorunuzu Sorabilirsiniz, katılım ve kullanım tamamen Ücretsizdir!

C# Hesap Makinesi Kodları

Panther

Forum Üyesi
Katılım
18 Eki 2022
Mesajlar
50
Puanları
0
Yaş
33
Konum
istanbul
Kodlar:
Kod: Tümünü Seç Tümünü Kopyala
Kod:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HesapMakinesi
{
public partial class Form1 : Form
{
double ilk_sayı = 0;
public Form1()
{
InitializeComponent();
}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
if (ilk_sayı != 0) textBox1.Text = "0";
if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button1.Text;
}

private void button2_Click(object sender, EventArgs e)
{
if (ilk_sayı != 0) textBox1.Text = "0";

if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button2.Text;

}

private void button3_Click(object sender, EventArgs e)
{
if (ilk_sayı != 0) textBox1.Text = "0";

if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button3.Text;
}

private void button4_Click(object sender, EventArgs e)
{
if (ilk_sayı != 0) textBox1.Text = "0";

if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button4.Text;
}

private void button5_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button5.Text;
}

private void button6_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button6.Text;
}

string işlem = "";
private void button7_Click(object sender, EventArgs e)
{
ilk_sayı = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
işlem = "-";

}

private void button9_Click(object sender, EventArgs e)
{
if (işlem == "-")
textBox1.Text = (ilk_sayı - Convert.ToDouble(textBox1.Text)).ToString();
if (işlem == "*")
textBox1.Text = (ilk_sayı * Convert.ToDouble(textBox1.Text)).ToString();
if (işlem == "+")
textBox1.Text = (ilk_sayı + Convert.ToDouble(textBox1.Text)).ToString();
if (işlem == "/")
textBox1.Text = (ilk_sayı / Convert.ToDouble(textBox1.Text)).ToString();
}

private void button8_Click(object sender, EventArgs e)
{
ilk_sayı = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
işlem = "*";
}

private void Form1_Load(object sender, EventArgs e)
{

}
double ikinci = 0;
private void button10_Click(object sender, EventArgs e)
{
if (ilk_sayı == 0)
{
ilk_sayı = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
işlem = "+";
}
else
{
ikinci = ilk_sayı + Convert.ToDouble(textBox1.Text);
textBox1.Text = ikinci.ToString();

}
}

private void button11_Click(object sender, EventArgs e)
{
ilk_sayı = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
işlem = "/";
}

private void button12_Click(object sender, EventArgs e)
{

textBox1.Text = textBox1.Text + button12.Text;

}

private void button15_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button15.Text;
}

private void button14_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button14.Text;
}

private void button13_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button13.Text;
}

private void button16_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0") textBox1.Text = "";
textBox1.Text = textBox1.Text + button16.Text;
}

private void button17_Click(object sender, EventArgs e)
{
ilk_sayı = 0;
textBox1.Text = "0";
}

private void button18_Click(object sender, EventArgs e)
{
if (textBox1.Text.Length == 1) textBox1.Text = "0";
else
textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1);
}
}
}
 
Üst