Esempio n. 1
0
        private void btnHesapla_Click(object sender, EventArgs e)
        {
            try
            {
                const int maxi  = Int32.MaxValue;
                int       sayi1 = int.Parse(txtBirinciSayi.Text);
                int       sayi2 = int.Parse(txt2Sayi.Text);
                int       sonuc = 0;



                if (sayi1 > maxi && sayi2 > maxi && sonuc > maxi)
                {
                    MessageBox.Show("Sayı limiti aşıldı");
                }

                string islemTuru = ddlIslem.Text;

                Islemler islem = new Islemler();



                if (islemTuru != null)
                {
                    if (islemTuru == "+")
                    {
                        sonuc = islem.Toplama(sayi1, sayi2);
                    }
                    else if (islemTuru == "-")
                    {
                        sonuc = islem.Cikarma(sayi1, sayi2);
                    }
                    else if (islemTuru == "*")
                    {
                        sonuc = islem.Carpma(sayi1, sayi2);
                    }
                    else if (islemTuru == "/")
                    {
                        sonuc = islem.Bolme(sayi1, sayi2);
                    }
                    else
                    {
                        MessageBox.Show("İşlem türü boş geçilemez..");
                    }

                    labelSonuc.Text = "Sonuc : " + sonuc.ToString();



                    if (sonuc > maxi)
                    {
                        MessageBox.Show("Maximum limit aşıldı");
                    }
                }
            }
            catch (Exception excep)
            {
                MessageBox.Show(excep.ToString());
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            float    sonuc = 0, deger1, deger2;
            Islemler obj = new Islemler();

            Console.WriteLine("Çarpma işlemini yapacağınız sayıları giriniz:...");
            deger1 = Convert.ToInt16(Console.ReadLine());
            deger2 = Convert.ToInt16(Console.ReadLine());
            sonuc  = obj.Carpma(deger1, deger2);

            Console.WriteLine(sonuc);
            Console.Read();
        }