ana sayfa > C# > C#’ta Hesap Makinesi

C#’ta Hesap Makinesi

Perşembe, 29 Eki 2009 yorum ekle yorumlara git

Merhabalar… C#ta hesap makinesi yapımını beraber inceleyelim…
Hesap_makinesi

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); }

 

        }           

    }

}




Benzer Konularımıza da Göz Atın!

coded by nessus
Share


Bu kategorideki rastgele diğer yazılar
  • » Sayısal Loto [C#]
  • » C# İki sayı arasındaki sayıların toplamı
  • » C# Varmısın Yokmusun Programı
  • » c#'ta Celcius Ve Fahrenayt
  • » C# If-Else & Switch-Case Yapısı
  • » Foreach Döngüsü [C#]
  • » Karakter Sayısı [C#]
  • » Asansör Kontrol Programı [C#]
  • » C# Büyük Ünlü Uyumu
  • » For Döngüsü [C#]
  • » C#'ta işlemler
  • » Visual Studio Menüleri - File Menüsü [C#]
  • » C# 2-9 arası rakamlara bölünebilen sayılar(combobox)
  • » C#'ta Radio Button Kullanımı
  • » C#'ta ListBox Ve ComboBox Kullanımı



    1. sema
      Pazartesi, 02 Kas 2009 zamanında 19:02 | #1

      bu programı gördüğümde ben bi garip hissediyom..10 saat bunla uğraşmıştık..:):)

    2. Fatih Aydın
      Çarşamba, 04 Kas 2009 zamanında 10:33 | #2

      Şefahat yine döktürmüş…:)

    3. Çarşamba, 04 Kas 2009 zamanında 15:33 | #3

      Evet Sema ugrastıkama bence ugrastıgımıza desmıs;) Fatıh yanlız degıldım:):)

    4. sema
      Çarşamba, 04 Kas 2009 zamanında 15:41 | #4

      orası öyle tabi de..anısı var yinede…:)

    5. Bengü Özgüngör
      Perşembe, 05 Kas 2009 zamanında 22:44 | #5

      bool isaret1;
      public Form1()

      bool ve public in görevi nedir ?

    6. Tansu
      Cuma, 06 Kas 2009 zamanında 00:18 | #6

      Merhaba Bengü..

      bool isaret1: derken;
      Mesela bilinen bir tamsayının 10′dan daha büyük olup olmadığını veya bilinen bir string ifadenin “defter” kelimesiyle özdeş olup olmadığını bilmek çok kolaydır. C#’ta mantıksal bir veri tipi tanımlarken “bool” ifadesini kullanıyoruz. Bir tamsayıyı mantıksal bir değişkene atamaya çalışıyorsak 0 ya da 1 yerine “true” veya “false” anahtar kelimelerini yazarız. Yazılan örnektede “bool isaret1=false;” dur.

      Public ise C#’ta örnek yaptığımızda kodların içinde bulunuyor :) )

    7. Bengü Özgüngör
      Cuma, 06 Kas 2009 zamanında 15:15 | #7

      ÇOK TEŞEKKÜR EDERİM :)

    8. Sefahat
      Cuma, 06 Kas 2009 zamanında 17:50 | #8

      Tansu Tesekkurler harıka acıklamıssın:):)

    9. sema
      Cuma, 06 Kas 2009 zamanında 18:19 | #9

      valla ya bn bile unutmuştum ne olduunun..tebrikler..:):)

    10. Tansu
      Cuma, 06 Kas 2009 zamanında 19:53 | #10

      Yardımcı olduysam ne mutlu bana :) Bilgilerimizi paylaşmak için buradayız..

    11. F@tmanur
      Cumartesi, 07 Kas 2009 zamanında 14:49 | #11

      tansu gayet güzel anlatmışsın :)

    12. Sefahat
      Cumartesi, 07 Kas 2009 zamanında 23:14 | #12

      Katılıyorum Tansuu..

    13. Bengü Özgüngör
      Salı, 17 Kas 2009 zamanında 20:35 | #13

      resim geçen hafta değişikmiydi ben mi öyle hatırlıyorum :)

    14. Sefahat
      Salı, 17 Kas 2009 zamanında 21:27 | #14

      Evet değişikti düzenledim Bengü..:) Harika gözlemcisin:):)

    15. Bengü Özgüngör
      Perşembe, 19 Kas 2009 zamanında 23:45 | #15

      ewd öyleyimdir çünkü geçen hafta butonlar dikkatimi çekti yapıyım dedim beceremedim acaba biraz yeniyim ondanmı diyorum ama neyse öğrenirim heralde süslü butonlar yapmayı :)

    16. Sefahat
      Cuma, 20 Kas 2009 zamanında 23:15 | #16

      hımm olabilir neden olmasın Kolaydır c# Öğrendikçe de zevklidir;) en azından bana göre..

    17. Bengü Özgüngör
      Pazar, 22 Kas 2009 zamanında 01:53 | #17

      evet gerçekten öyle öğrendikçe güzelleşiyo okulda php den çok c# seviyorum arkadaşlarım bnm tam tersim..

    18. Salı, 22 Ara 2009 zamanında 18:19 | #18

      kardes pekı bu hesap makınasını fortranda yazabılırmısın algorıtma ve flowchartı ıle bırlıkte eger yapabılırsn veya elınde hazır halı varsa bana mail atarsan cok sevınırım bu benım proje odevım sımdıden saygılar
      mail adresim ceza_feyzal_ceza@hotmail.com

    19. can
      Salı, 29 Ara 2009 zamanında 23:56 | #19

      bool isaret1 değişkeni hangi amaçla tanımlanmıs?

    1. şimdilik geri bağlantı yok

    *
    Bu bir spamlara karşı koruma yazılımıdır, resimde gösterilen güvenlik kelimesi girilmelidir. Kelimeyi sesli duymak için resmi tıklayın
    Anti-spam kelimeyi duymak için tıklayın