• Forumzar.COM Türkçe içerikli genel forum sitesi ve paylaşım platformu olarak eğlenceli ve interaktif bir forum deneyim sunar.

    Foruma üye olmak için BURAYA TIKLAYINIZ

C# Hesap Makinesi Kodları

mehmet26

Forum Üyesi
Katılım
19 Eki 2022
Mesajlar
50
Puanları
6
Konum
Eskisehir
Cinsiyet
Erkek
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);
}
}
}
 

Genel Forum Sitesi

Forum Sitesi - Forumzar.COM

Forumzar.COM olarak, Türkçe forum sitesi denildiğinde akla gelen ilk adres olarak, geniş kapsamlı genel forum platformumuzda buluşuyoruz. Türkiye'nin en büyük Türkçe forum siteleri arasında yer almanın gururunu yaşıyoruz. Çeşitli konu başlıklarında aktif bir şekilde paylaşımların yapıldığı, her konuda interaktif ve bilgilendirici tartışmalara katılmak için bizi takip edin! ve bir dakikanızı ayırarak forum sitemize üye olun!

Forum Siteleri

Bilgi paylaştıkça çoğalır sloganı ile ilerleyen forum sitesi platformumuza, siz de üye olarak forum sitemizde açılan konulara katılabilir ve ilgi alanınıza uygun konular açarak siz de paylaşımda bulunabilirsiniz.