C # ta Hesap Makinesi Yapımı

Ana sayfa Forumlar PROGRAMLAMA C# C # ta Hesap Makinesi Yapımı

  • Bu konu 3 yanıt içerir, 2 izleyen vardır ve en son 12 yıl önce özgür tarafından güncellenmiştir.
4 yazı görüntüleniyor - 1 ile 4 arası (toplam 4)
  • Yazar
    Yazılar
  • #12394

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication2

    {

    public partial class Form1 : Form

    {

    //Tanımlamalarımız.

    int sayi1,sayi;

    string isaret = ??;

    bool isaret1;

    public Form1()

    {

    InitializeComponent();

    }

    private void button10_Click(object sender, EventArgs e)

    {

    //Rakamların Girisi

    //Rakam 0

    if (isaret1 == true)

    textBox1.Text = ?0?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?0?;

    else

    textBox1.Text = textBox1.Text + ?0?;

    isaret1 = false;

    }

    private void button1_Click(object sender, EventArgs e)

    {

    //Rakam 1

    if (isaret1 == true)

    textBox1.Text = ?1?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?1?;

    else

    textBox1.Text = textBox1.Text + ?1?;

    isaret1 = false;

    }

    private void button2_Click(object sender, EventArgs e)

    {

    //Rakam 2

    if (isaret1 == true)

    textBox1.Text = ?2?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?2?;

    else

    textBox1.Text = textBox1.Text + ?2?;

    isaret1 = false;

    }

    private void button3_Click(object sender, EventArgs e)

    {

    //Rakam 3

    if (isaret1 == true)

    textBox1.Text = ?3?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?3?;

    else

    textBox1.Text = textBox1.Text + ?3?;

    isaret1 = false;

    }

    private void button4_Click(object sender, EventArgs e)

    {

    //Rakam 4

    if (isaret1 == true)

    textBox1.Text = ?4?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?4?;

    else

    textBox1.Text = textBox1.Text + ?4?;

    isaret1 = false;

    }

    private void button5_Click(object sender, EventArgs e)

    {

    //Rakam 5

    if (isaret1 == true)

    textBox1.Text = ?5?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?5?;

    else

    textBox1.Text = textBox1.Text + ?5?;

    isaret1 = false;

    }

    private void button6_Click(object sender, EventArgs e)

    {

    //Rakam 6

    if (isaret1 == true)

    textBox1.Text = ?6?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?6?;

    else

    textBox1.Text = textBox1.Text + ?6?;

    isaret1 = false;

    }

    private void button7_Click(object sender, EventArgs e)

    {

    //Rakam 7

    if (isaret1 == true)

    textBox1.Text = ?7?;

    else

    if (textBox1.Text == ?0?)

    textBox1.Text = ?7?;

    else

    textBox1.Text = textBox1.Text + ?7?;

    isaret1 = false;

    }

    private void button8_Click(object sender, EventArgs e)

    {

    //Rakam 8

    if (isaret1 == true)

    textBox1.Text = ?8?;

    else

    if (textBox1.Text == ?0? )

    textBox1.Text = ?8?;

    else

    textBox1.Text = textBox1.Text + ?8?;

    isaret1 = false;

    }

    private void button9_Click(object sender, EventArgs e)

    {

    //Rakam 9

    if (isaret1 == true)

    textBox1.Text = ?9?;

    else

    if (textBox1.Text == ?0? )

    textBox1.Text = ?9?;

    else

    textBox1.Text = textBox1.Text + ?9?;

    isaret1 = false;

    }

    private void button11_Click(object sender, EventArgs e)

    {

    //C ?Yani Silme Butonumuz

    isaret1 = false;

    isaret = ??;

    textBox1.Text = ?0?;

    }

    private void button12_Click(object sender, EventArgs e)

    {

    //+ ?Toplama? Butonumuz

    if (isaret == ??)

    sayi = Convert.ToInt32(textBox1.Text);

    else

    {

    sayi1 = Convert.ToInt32(textBox1.Text);

    if (isaret == ?+?) { sayi = sayi + sayi1; textBox1.Text = Convert.ToString(sayi); }

    }

    isaret1 = true;

    isaret = ?+?;

    }

    private void button13_Click(object sender, EventArgs e)

    {

    //- ?Çıkarma? Butonumuz

    if (isaret == ??)

    sayi = Convert.ToInt32(textBox1.Text);

    else

    {

    sayi1 = Convert.ToInt32(textBox1.Text);

    if (isaret == ?-?) { sayi = sayi ? sayi1; textBox1.Text = Convert.ToString(sayi); }

    }

    isaret1 = true;

    isaret = ?-?;

    }

    private void button14_Click(object sender, EventArgs e)

    {

    // * ?Çarpma? Butonumuz

    if (isaret == ??)

    sayi = Convert.ToInt32(textBox1.Text);

    else

    {

    sayi1 = Convert.ToInt32(textBox1.Text);

    if (isaret == ?*?) { sayi = sayi * sayi1; textBox1.Text = Convert.ToString(sayi); }

    }

    isaret1 = true;

    isaret = ?*?;

    }

    private void button15_Click(object sender, EventArgs e)

    {

    // / ?Bölme? Butonumuz

    if (isaret == ??)

    sayi = Convert.ToInt32(textBox1.Text);

    else

    {

    sayi1 = Convert.ToInt32(textBox1.Text);

    if (isaret == ?/?) { sayi = sayi / sayi1; textBox1.Text = Convert.ToString(sayi); }

    }

    isaret1 = true;

    isaret = ?/?;

    }

    private void button16_Click(object sender, EventArgs e)

    {

    // = ?Eşittir? Butonumuz

    isaret1 = true;

    sayi1 = Convert.ToInt32(textBox1.Text);

    if (isaret == ?+?) { sayi = sayi + sayi1; textBox1.Text = Convert.ToString(sayi); }

    if (isaret == ?-?) { sayi = sayi ? sayi1; textBox1.Text = Convert.ToString(sayi); }

    if (isaret == ?*?) { sayi = sayi * sayi1; textBox1.Text = Convert.ToString(sayi); }

    if (isaret == ?/?) { sayi = sayi / sayi1; textBox1.Text = Convert.ToString(sayi); }

    }

    }

    }

    #12395

    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 Hesap_Makinası
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }
    int sayi1;
    int sayi2;
    int sonuc;
    private void btnarti_Click(object sender, EventArgs e)
    {
    sayi1 = Convert.ToInt32(txtsayi1.Text);
    sayi2 = Convert.ToInt32(txtsayi2.Text);
    sonuc = sayi1 + sayi2;
    label1.Text = sonuc.ToString();

    }

    private void btneksi_Click(object sender, EventArgs e)
    {
    sonuc = sayi1 – sayi2;
    label1.Text = sonuc.ToString();

    }

    private void btncarp_Click(object sender, EventArgs e)
    {
    sonuc = sayi1 * sayi2;
    label1.Text = sonuc.ToString();
    }

    private void btnböl_Click(object sender, EventArgs e)
    {
    sonuc = sayi1 / sayi2;
    label1.Text = sonuc.ToString();

    }
    }
    }

    #12396

    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 hesap_makinesi
    {
    class Class1 //işlemlerimizi yaptıracağımız Class1 isimli bir class açıyoruz.
    {
    public int topla(int a, int b)
    {
    return a + b;
    }
    public int cikar(int a, int b)
    {
    return a ? b;
    }
    public int carp(int a, int b)
    {
    return a * b;
    }
    public int böl(int a, int b)
    {
    return a / b;
    }
    }
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    Class1 cs = new Class1(); //Class1 isimli class tan cs adlı bir nesne türetiyoruz
    private void button1_Click(object sender, EventArgs e)
    {
    int s1 = Convert.ToInt32(textBox1.Text);
    int s2 = Convert.ToInt32(textBox2.Text);
    textBox3.Text = Convert.ToString(cs.topla(s1, s2)); //textBox1 ve textBox2 den girilen değerleri topla fonk. yolluyoruz.
    }

    private void button2_Click(object sender, EventArgs e)
    {
    int s1 = Convert.ToInt32(textBox1.Text);
    int s2 = Convert.ToInt32(textBox2.Text);
    textBox3.Text = Convert.ToString(cs.cikar(s1, s2));//textBox1 ve textBox2 den girilen değerleri cikar fonk. yolluyoruz
    }

    private void button3_Click(object sender, EventArgs e)
    {
    int s1 = Convert.ToInt32(textBox1.Text);
    int s2 = Convert.ToInt32(textBox2.Text);
    textBox3.Text = Convert.ToString(cs.carp(s1, s2)); //textBox1 ve textBox2 den girilen değerleri carp fonk. yolluyoruz
    }

    private void button4_Click(object sender, EventArgs e)
    {
    int s1 = Convert.ToInt32(textBox1.Text);
    int s2 = Convert.ToInt32(textBox2.Text);
    textBox3.Text = Convert.ToString(cs.böl(s1, s2)); //textBox1 ve textBox2 den girilen değerleri böl fonk. yolluyoruz
    }

    }
    }

    #12402
    özgür
    İzleyici

    teşekkürler kardeşim ama daha kısa kodla daha güzel durur eline sağlık

4 yazı görüntüleniyor - 1 ile 4 arası (toplam 4)
  • Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Bana Ders Anlat © 2008-2022