21 Aralık 2013 Cumartesi

C # PROGRAMI İLE ÖRNEK SORULAR-47

METİN ŞİFRELEME

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace Sifre2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
ArrayList harfDepo = new ArrayList();
ArrayList harfOku = new ArrayList();
string giris,anahtarOku, ekran="", sifre =
"AJXNUĞDWOYFPCVQLZHUĐCRGKSIOETMSB";
int i, j, anahtar;
double sira = 0;
for (i = 0; i < sifre.Length; i++)
{
harfDepo.Add(sifre.Substring(i, 1));
}
//Harfler harfDepo Đcerisine Aktarıldı.
giris = textBox1.Text;
giris = giris.ToUpper();
if (giris == "")
{
MessageBox.Show(this, "Sifrelenecek Veri Girisi Yapılmadı...!!!");
}
else
{
anahtarOku = textBox3.Text;
if (anahtarOku=="")
{
MessageBox.Show(this, "Anahtar Girisi Yapılmadı...!!!");
}
else
{
anahtar = Convert.ToInt32(anahtarOku);
if (anahtar>=0 && anahtar < 250)
{
for (i = 0; i < giris.Length; i++)
{
harfOku.Add(giris.Substring(i, 1));
}
if (harfOku.Contains(" "))
{
MessageBox.Show(this, "Verilen Đfadede Bosluk
Kullanılmıs!!!");
harfOku.Clear();
}
for (i = 0; i < harfOku.Count; i++)
{
for (j = 0; j < harfDepo.Count; j++)
{
sira = harfDepo.IndexOf(harfOku[i], 0,
harfDepo.Count);
}
sira = Math.Pow(sira + 123, 2) + 1453 +
Math.Pow(anahtar, 2);
ekran = ekran + sira.ToString();
}
}
else
{
MessageBox.Show(this, "Anahtar 0-250 Aralığını
Gecmemeli...!!!");
textBox3.Text = "";
}
}
textBox1.Text = ekran;
}
}
private void button2_Click(object sender, EventArgs e)
{
ArrayList geciciDepo = new ArrayList();
ArrayList harfDepo = new ArrayList();
ArrayList sayiOku = new ArrayList();
string giris, anahtarOku, ekran = "", sifre =
"AJXNUĞDWOYFPCVQLZHUĐCRGKSIOETMSB";
int i, j, anahtar,sayi,artan,sira2;
double sira = 0;
for (i = 0; i < sifre.Length; i++)
{
harfDepo.Add(sifre.Substring(i, 1));
}
//Harfler harfDepo Đcerisine Aktarıldı.
giris = textBox2.Text;
if (giris == "")
{
MessageBox.Show(this, "Cozulecek Sifre Girisi Yapılmadı...!!!");
}
else
{
anahtarOku = textBox3.Text;
if (anahtarOku=="")
{
MessageBox.Show(this, "Anahtar Girisi Yapılmadı...!!!");
}
else
{
anahtar = Convert.ToInt32(anahtarOku);
if (anahtar>=0 && anahtar < 250)
{
if (giris.Length % 5 == 0)
{
j=0;
for (i = 0; i < giris.Length; i+=5)
{
sayiOku.Add(giris.Substring(i, 5));
}
}
else
{
artan = giris.Length % 5;
for (i = 0; i < giris.Length-artan; i+=5)
{
sayiOku.Add(giris.Substring(i, 5));
}
}
for (i = 0; i < sayiOku.Count; i++)
{
sira = Convert.ToInt32(sayiOku[i]);
sira = sira - Math.Pow(anahtar,2);
sira = sira - 1453;
sira = Math.Sqrt(sira);
sira = sira - 123;
sira2 = Convert.ToInt32(sira);
ekran = ekran + harfDepo[sira2];
}
}
else
{
MessageBox.Show(this, "Anahtar 0-250 Aralığını
Gecmemeli...!!!");
textBox3.Text = "";
}
}
textBox2.Text = ekran;
}
}
}


C # PROGRAMI İLE ÖRNEK SORULAR-46

RESİMLİ LİSTE

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Resimli_Liste
{
      /// <summary>
      /// Summary description for Form1.
      /// </summary>
      public class Form1 : System.Windows.Forms.Form
      {
  internal System.Windows.Forms.ListBox listBox1;
  internal System.Windows.Forms.ImageList ımageList1;
  private System.ComponentModel.IContainer components;

            public Form1()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();

                  //
                  // TODO: Add any constructor code after InitializeComponent call
                  //
            }

            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  if( disposing )
                  {
                        if (components != null)
                        {
                             components.Dispose();
                        }
                  }
                  base.Dispose( disposing );
            }

            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
   this.components = new System.ComponentModel.Container();
   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
   this.listBox1 = new System.Windows.Forms.ListBox();
   this.ımageList1 = new System.Windows.Forms.ImageList(this.components);
   this.SuspendLayout();
   //
   // listBox1
   //
   this.listBox1.Location = new System.Drawing.Point(8, 8);
   this.listBox1.Name = "listBox1";
   this.listBox1.Size = new System.Drawing.Size(144, 199);
   this.listBox1.TabIndex = 1;
   this.listBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.listBox1_DrawItem);
   //
   // ımageList1
   //
   this.ımageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
   this.ımageList1.ImageSize = new System.Drawing.Size(32, 32);
   this.ımageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ımageList1.ImageStream")));
   this.ımageList1.TransparentColor = System.Drawing.Color.Transparent;
   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   this.ClientSize = new System.Drawing.Size(160, 214);
   this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                              this.listBox1});
   this.Name = "Form1";
   this.Text = "Form1";
   this.Load += new System.EventHandler(this.Form1_Load);
   this.ResumeLayout(false);

  }
            #endregion

            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                  Application.Run(new Form1());
            }

  private void Form1_Load(object sender, System.EventArgs e)
  {
   string[] x = {"CD Rom", "Disket", "Monitör", "Fare", "Klavye",
                 "Bilgisayar"};
   listBox1.DrawMode = DrawMode.OwnerDrawFixed;//Sabit yükseklikli liste
   listBox1.ItemHeight = 32;//Her eleman 32 pixel yüksekliğinde olacak
   listBox1.Items.AddRange(x);//Dizideki elemanları listeye ekle
  }

  private void listBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
  {
   string s;
   s = listBox1.Items[e.Index].ToString();
   e.DrawBackground();
   e.DrawFocusRectangle();
   ımageList1.Draw(e.Graphics, e.Bounds.Left, e.Bounds.Top, e.Index);
   e.Graphics.DrawString(s, new Font("Tahoma", 14, FontStyle.Bold),
    new SolidBrush(Color.Black),
    e.Bounds.Left + 35, e.Bounds.Top);
  }
      }
}



C # PROGRAMI İLE ÖRNEK SORULAR-45

YÜRÜYEN YAZI ÖRNEĞİ

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace YürüyenYazı
{
      /// <summary>
      /// Summary description for Form1.
      /// </summary>
      public class Form1 : System.Windows.Forms.Form
      {
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.Timer timer1;
  private System.ComponentModel.IContainer components;

            public Form1()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();

                  //
                  // TODO: Add any constructor code after InitializeComponent call
                  //
            }

            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  if( disposing )
                  {
                        if (components != null)
                        {
                             components.Dispose();
                        }
                  }
                  base.Dispose( disposing );
            }

            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
   this.components = new System.ComponentModel.Container();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.timer1 = new System.Windows.Forms.Timer(this.components);
   this.SuspendLayout();
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(8, 8);
   this.textBox1.Name = "textBox1";
   this.textBox1.Size = new System.Drawing.Size(280, 20);
   this.textBox1.TabIndex = 0;
   this.textBox1.Text = "textBox1";
   //
   // timer1
   //
   this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                              this.textBox1});
   this.Name = "Form1";
   this.Text = "Form1";
   this.Load += new System.EventHandler(this.Form1_Load);
   this.ResumeLayout(false);

  }
            #endregion

            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                  Application.Run(new Form1());
            }

  private void Form1_Load(object sender, System.EventArgs e)
  {
   textBox1.Text = "Yürüyen yazı             ";
   timer1.Interval = 100;
   timer1.Enabled = true;
  }

  private void timer1_Tick(object sender, System.EventArgs e)
  {
     textBox1.Text = textBox1.Text.Substring(1)
                  + textBox1.Text.Substring(0,1);
  }
      }

}

C # PROGRAMI İLE ÖRNEK HESAP MAKİNESİ KODLARI

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace HesMak
{
      /// <summary>
      /// Summary description for Form1.
      /// </summary>
      public class HesapMak : System.Windows.Forms.Form
      {
            private System.Windows.Forms.TextBox sonuc;
            private System.Windows.Forms.Button c;
            private System.Windows.Forms.Button yedi;
            private System.Windows.Forms.Button sekiz;
            private System.Windows.Forms.Button dokuz;
            private System.Windows.Forms.Button dort;
            private System.Windows.Forms.Button bes;
            private System.Windows.Forms.Button alti;
            private System.Windows.Forms.Button bir;
            private System.Windows.Forms.Button iki;
            private System.Windows.Forms.Button uc;
            private System.Windows.Forms.Button sifir;
            private System.Windows.Forms.Button carpma;
            private System.Windows.Forms.Button us;
            private System.Windows.Forms.Button bolme;
            private System.Windows.Forms.Button log;
            private System.Windows.Forms.Button toplama;
            private System.Windows.Forms.Button isaret;
            private System.Windows.Forms.Button nokta;
            private System.Windows.Forms.Button cikarma;
            private System.Windows.Forms.Button esittir;
            private System.Windows.Forms.Button reset;
            private System.Windows.Forms.Button kare;

            bool sonbasilan,nokt;
            //bool ex;
            double ilk;
            int sonislemno;
           
           
           
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;

            public HesapMak()
            {
           
                  sonbasilan=false;
                  nokt=false;
                  //ex=false;
                  sonislemno=0;
                  ilk=0.0;
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();
                 


                  //
                  // TODO: Add any constructor code after InitializeComponent call
                  //
            }

            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  if( disposing )
                  {
                        if (components != null)
                        {
                              components.Dispose();
                        }
                  }
                  base.Dispose( disposing );
            }

            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                  this.sonuc = new System.Windows.Forms.TextBox();
                  this.reset = new System.Windows.Forms.Button();
                  this.c = new System.Windows.Forms.Button();
                  this.yedi = new System.Windows.Forms.Button();
                  this.sekiz = new System.Windows.Forms.Button();
                  this.dokuz = new System.Windows.Forms.Button();
                  this.carpma = new System.Windows.Forms.Button();
                  this.us = new System.Windows.Forms.Button();
                  this.dort = new System.Windows.Forms.Button();
                  this.bes = new System.Windows.Forms.Button();
                  this.alti = new System.Windows.Forms.Button();
                  this.bolme = new System.Windows.Forms.Button();
                  this.log = new System.Windows.Forms.Button();
                  this.bir = new System.Windows.Forms.Button();
                  this.iki = new System.Windows.Forms.Button();
                  this.uc = new System.Windows.Forms.Button();
                  this.toplama = new System.Windows.Forms.Button();
                  this.kare = new System.Windows.Forms.Button();
                  this.isaret = new System.Windows.Forms.Button();
                  this.sifir = new System.Windows.Forms.Button();
                  this.nokta = new System.Windows.Forms.Button();
                  this.cikarma = new System.Windows.Forms.Button();
                  this.esittir = new System.Windows.Forms.Button();
                  this.SuspendLayout();
                  //
                  // sonuc
                  //
                  this.sonuc.Location = new System.Drawing.Point(32, 32);
                  this.sonuc.Name = "sonuc";
                  this.sonuc.Size = new System.Drawing.Size(304, 20);
                  this.sonuc.TabIndex = 0;
                  this.sonuc.Text = "0";
                  this.sonuc.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
                  this.sonuc.TextChanged += new System.EventHandler(this.sonuc_TextChanged);
                  //
                  // reset
                  //
                  this.reset.Location = new System.Drawing.Point(224, 80);
                  this.reset.Name = "reset";
                  this.reset.Size = new System.Drawing.Size(48, 32);
                  this.reset.TabIndex = 1;
                  this.reset.Text = "Reset";
                  this.reset.Click += new System.EventHandler(this.reset_Click);
                  //
                  // c
                  //
                  this.c.Location = new System.Drawing.Point(288, 80);
                  this.c.Name = "c";
                  this.c.Size = new System.Drawing.Size(48, 32);
                  this.c.TabIndex = 2;
                  this.c.Text = "C";
                  //
                  // yedi
                  //
                  this.yedi.Location = new System.Drawing.Point(32, 136);
                  this.yedi.Name = "yedi";
                  this.yedi.Size = new System.Drawing.Size(48, 32);
                  this.yedi.TabIndex = 3;
                  this.yedi.Text = "7";
                  this.yedi.Click += new System.EventHandler(this.yedi_Click);
                  //
                  // sekiz
                  //
                  this.sekiz.Location = new System.Drawing.Point(96, 136);
                  this.sekiz.Name = "sekiz";
                  this.sekiz.Size = new System.Drawing.Size(48, 32);
                  this.sekiz.TabIndex = 4;
                  this.sekiz.Text = "8";
                  this.sekiz.Click += new System.EventHandler(this.sekiz_Click);
                  //
                  // dokuz
                  //
                  this.dokuz.Location = new System.Drawing.Point(160, 136);
                  this.dokuz.Name = "dokuz";
                  this.dokuz.Size = new System.Drawing.Size(48, 32);
                  this.dokuz.TabIndex = 5;
                  this.dokuz.Text = "9";
                  this.dokuz.Click += new System.EventHandler(this.dokuz_Click);
                  //
                  // carpma
                  //
                  this.carpma.Location = new System.Drawing.Point(224, 136);
                  this.carpma.Name = "carpma";
                  this.carpma.Size = new System.Drawing.Size(48, 32);
                  this.carpma.TabIndex = 6;
                  this.carpma.Text = "*";
                  this.carpma.Click += new System.EventHandler(this.carpma_Click);
                  //
                  // us
                  //
                  this.us.Location = new System.Drawing.Point(288, 136);
                  this.us.Name = "us";
                  this.us.Size = new System.Drawing.Size(48, 32);
                  this.us.TabIndex = 7;
                  this.us.Text = "Us";
                  this.us.Click += new System.EventHandler(this.us_Click);
                  //
                  // dort
                  //
                  this.dort.Location = new System.Drawing.Point(32, 184);
                  this.dort.Name = "dort";
                  this.dort.Size = new System.Drawing.Size(48, 32);
                  this.dort.TabIndex = 8;
                  this.dort.Text = "4";
                  this.dort.Click += new System.EventHandler(this.dort_Click);
                  //
                  // bes
                  //
                  this.bes.Location = new System.Drawing.Point(96, 184);
                  this.bes.Name = "bes";
                  this.bes.Size = new System.Drawing.Size(48, 32);
                  this.bes.TabIndex = 9;
                  this.bes.Text = "5";
                  this.bes.Click += new System.EventHandler(this.bes_Click);
                  //
                  // alti
                  //
                  this.alti.Location = new System.Drawing.Point(160, 184);
                  this.alti.Name = "alti";
                  this.alti.Size = new System.Drawing.Size(48, 32);
                  this.alti.TabIndex = 10;
                  this.alti.Text = "6";
                  this.alti.Click += new System.EventHandler(this.alti_Click);
                  //
                  // bolme
                  //
                  this.bolme.Location = new System.Drawing.Point(224, 184);
                  this.bolme.Name = "bolme";
                  this.bolme.Size = new System.Drawing.Size(48, 32);
                  this.bolme.TabIndex = 11;
                  this.bolme.Text = "/";
                  this.bolme.Click += new System.EventHandler(this.bolme_Click);
                  //
                  // log
                  //
                  this.log.Location = new System.Drawing.Point(288, 184);
                  this.log.Name = "log";
                  this.log.Size = new System.Drawing.Size(48, 32);
                  this.log.TabIndex = 12;
                  this.log.Text = "log";
                  this.log.Click += new System.EventHandler(this.log_Click);
                  //
                  // bir
                  //
                  this.bir.Location = new System.Drawing.Point(32, 232);
                  this.bir.Name = "bir";
                  this.bir.Size = new System.Drawing.Size(48, 32);
                  this.bir.TabIndex = 13;
                  this.bir.Text = "1";
                  this.bir.Click += new System.EventHandler(this.bir_Click);
                  //
                  // iki
                  //
                  this.iki.Location = new System.Drawing.Point(96, 232);
                  this.iki.Name = "iki";
                  this.iki.Size = new System.Drawing.Size(48, 32);
                  this.iki.TabIndex = 14;
                  this.iki.Text = "2";
                  this.iki.Click += new System.EventHandler(this.iki_Click);
                  //
                  // uc
                  //
                  this.uc.Location = new System.Drawing.Point(160, 232);
                  this.uc.Name = "uc";
                  this.uc.Size = new System.Drawing.Size(48, 32);
                  this.uc.TabIndex = 15;
                  this.uc.Text = "3";
                  this.uc.Click += new System.EventHandler(this.uc_Click);
                  //
                  // toplama
                  //
                  this.toplama.Location = new System.Drawing.Point(224, 232);
                  this.toplama.Name = "toplama";
                  this.toplama.Size = new System.Drawing.Size(48, 32);
                  this.toplama.TabIndex = 16;
                  this.toplama.Text = "+";
                  this.toplama.Click += new System.EventHandler(this.toplama_Click);
                  //
                  // kare
                  //
                  this.kare.Location = new System.Drawing.Point(288, 232);
                  this.kare.Name = "kare";
                  this.kare.Size = new System.Drawing.Size(48, 32);
                  this.kare.TabIndex = 17;
                  this.kare.Text = "Kare";
                  this.kare.Click += new System.EventHandler(this.kare_Click);
                  //
                  // isaret
                  //
                  this.isaret.Location = new System.Drawing.Point(32, 280);
                  this.isaret.Name = "isaret";
                  this.isaret.Size = new System.Drawing.Size(48, 32);
                  this.isaret.TabIndex = 18;
                  this.isaret.Text = "+/-";
                  this.isaret.Click += new System.EventHandler(this.isaret_Click);
                  //
                  // sifir
                  //
                  this.sifir.Location = new System.Drawing.Point(96, 280);
                  this.sifir.Name = "sifir";
                  this.sifir.Size = new System.Drawing.Size(48, 32);
                  this.sifir.TabIndex = 19;
                  this.sifir.Text = "0";
                  this.sifir.Click += new System.EventHandler(this.sifir_Click);
                  //
                  // nokta
                  //
                  this.nokta.Location = new System.Drawing.Point(160, 280);
                  this.nokta.Name = "nokta";
                  this.nokta.Size = new System.Drawing.Size(48, 32);
                  this.nokta.TabIndex = 20;
                  this.nokta.Text = ".";
                  this.nokta.Click += new System.EventHandler(this.nokta_Click);
                  //
                  // cikarma
                  //
                  this.cikarma.Location = new System.Drawing.Point(224, 280);
                  this.cikarma.Name = "cikarma";
                  this.cikarma.Size = new System.Drawing.Size(48, 32);
                  this.cikarma.TabIndex = 21;
                  this.cikarma.Text = "-";
                  this.cikarma.Click += new System.EventHandler(this.cikarma_Click);
                  //
                  // esittir
                  //
                  this.esittir.Location = new System.Drawing.Point(288, 280);
                  this.esittir.Name = "esittir";
                  this.esittir.Size = new System.Drawing.Size(48, 32);
                  this.esittir.TabIndex = 22;
                  this.esittir.Text = "=";
                  this.esittir.Click += new System.EventHandler(this.esittir_Click);
                  //
                  // HesapMak
                  //
                  this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                  this.ClientSize = new System.Drawing.Size(368, 334);
                  this.Controls.Add(this.esittir);
                  this.Controls.Add(this.cikarma);
                  this.Controls.Add(this.nokta);
                  this.Controls.Add(this.sifir);
                  this.Controls.Add(this.isaret);
                  this.Controls.Add(this.kare);
                  this.Controls.Add(this.toplama);
                  this.Controls.Add(this.uc);
                  this.Controls.Add(this.iki);
                  this.Controls.Add(this.bir);
                  this.Controls.Add(this.log);
                  this.Controls.Add(this.bolme);
                  this.Controls.Add(this.alti);
                  this.Controls.Add(this.bes);
                  this.Controls.Add(this.dort);
                  this.Controls.Add(this.us);
                  this.Controls.Add(this.carpma);
                  this.Controls.Add(this.dokuz);
                  this.Controls.Add(this.sekiz);
                  this.Controls.Add(this.yedi);
                  this.Controls.Add(this.c);
                  this.Controls.Add(this.reset);
                  this.Controls.Add(this.sonuc);
                  this.Name = "HesapMak";
                  this.Text = "Hesap Makinesi";
                  this.Load += new System.EventHandler(this.Form1_Load);
                  this.ResumeLayout(false);

            }
            #endregion

            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                  Application.Run(new HesapMak());
            }

           

            private void sonuc_TextChanged(object sender, System.EventArgs e)
            {
           
            }

            private void Form1_Load(object sender, System.EventArgs e)
            {
                 
            }

            private void sekiz_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+8;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"8";
                  else
                        if(true)
                        sonuc.Text=""+"8";
                  //if(ex)
                  //    ex=false;
            }

            private void yedi_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+"7";
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                             sonuc.Text=sonuc.Text+"7";
                        else
                             if(true)
                             sonuc.Text=""+"7";
                  //if(ex)
                  //    ex=false;
            }

            private void bir_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+1;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"1";
                        else
                             if(true)
                             sonuc.Text=""+"1";
                  //if(ex)
                  //    ex=false;


            }

            private void iki_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+2;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"2";
                  else
                        if(true)
                        sonuc.Text=""+"2";
                  //if(ex)
                  //    ex=false;
            }

            private void uc_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+3;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"3";
                  else
                        if(true)
                        sonuc.Text=""+"3";
                  //if(ex)
                  //    ex=false;
            }

            private void dort_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+4;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"4";
                  else
                        if(true)
                        sonuc.Text=""+"4";
                  //if(ex)
                  //    ex=false;
            }

            private void bes_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+5;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"5";
                  else
                        if(true)
                        sonuc.Text=""+"5";
                  //if(ex)
                  //    ex=false;
            }

            private void alti_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+6;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"6";
                  else
                        if(true)
                        sonuc.Text=""+"6";
                  //if(ex)
                  //    ex=false;
            }

           

            private void dokuz_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+9;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"9";
                  else
                        if(true)
                        sonuc.Text=""+"9";
                  //if(ex)
                        //ex=false;
            }

            private void sifir_Click(object sender, System.EventArgs e)
            {
                  if(sonbasilan)
                  {
                        sonuc.Text=""+0;
                        sonbasilan=false;
                  }
                  else
                        if(!sonuc.Text.Equals("0"))
                        sonuc.Text=sonuc.Text+"0";
                  else
                        if(true)
                        sonuc.Text=""+"0";
                  //if(ex)
                        //ex=false;
            }

            private void reset_Click(object sender, System.EventArgs e)
            {
                  sonuc.Text="0";
                  sonbasilan=false;
                  nokt=false;
                  sonislemno=0;
                  ilk=0;
                  //ex=false;
            }

            private void nokta_Click(object sender, System.EventArgs e)
            {
                  if(!nokt)
                  {
                        if(sonbasilan)
                             sonuc.Text="0.";
                        else
                             sonuc.Text=sonuc.Text+".";
                        nokt=true;
                        sonbasilan=false;
                        //if(ex)
                        //    ex=false;
                  }
            }

            private void isaret_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        double x=Convert.ToDouble(sonuc.Text);
                        if(x!=0.0)
                        {
                             x*=-1;
                             sonuc.Text=""+x;
                        }

                  //}
            }

            private void toplama_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno==0 || sonbasilan)
                        {
                             ilk=Convert.ToDouble(sonuc.Text);
                             sonislemno=3;
                             sonbasilan=true;
                             nokt=false;
                        }
                        else
                             islemYap(3);
                  //}
            }

            private void cikarma_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno==0 || sonbasilan)
                        {
                             ilk=Convert.ToDouble(sonuc.Text);
                             sonislemno=4;
                             sonbasilan=true;
                             nokt=false;
                        }
                        else
                             islemYap(4);
                  //}
            }

            private void carpma_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno==0 || sonbasilan)
                        {
                             ilk=Convert.ToDouble(sonuc.Text);
                             sonislemno=1;
                             sonbasilan=true;
                             nokt=false;
                        }
                        else
                             islemYap(1);
                  //}
            }

            private void bolme_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno==0 || sonbasilan)
                        {
                             ilk=Convert.ToDouble(sonuc.Text);
                             sonislemno=2;
                             sonbasilan=true;
                             nokt=false;
                        }
                        else
                             islemYap(2);
                  //}
            }

            private void us_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno==0 || sonbasilan)
                        {
                             ilk=Convert.ToDouble(sonuc.Text);
                             sonislemno=5;
                             sonbasilan=true;
                             nokt=false;
                        }
                        else
                             islemYap(5);
                  //}
            }

            private void log_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno==0 || sonbasilan)
                        {
                             double x=Convert.ToDouble(sonuc.Text);
                             if(x<0.0)
                             {
                                   //negatifse islem yapmaz
                             }    
                             else
                             {
                                   sonuc.Text=""+Math.Log(x);
                                   sonislemno=0;
                                   sonbasilan=true;
                                   nokt=false;
                             }
                                  
                        }
                        else
                        islemYap(0);
                  //}
            }

            private void kare_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno==0 || sonbasilan)
                        {
                              double x=Convert.ToDouble(sonuc.Text);
                             sonuc.Text=""+(x*x);
                             sonislemno=0;
                             sonbasilan=true;
                             nokt=false;
                        }
                        else
                             islemYap(0);
                  //}
            }

            private void esittir_Click(object sender, System.EventArgs e)
            {
                  //if(!ex)
                  //{
                        if(sonislemno>0)
                             islemYap(0);
                        else
                        {
                             sonbasilan=true;
                             nokt=false;
                        }
                  //}
            }

            private double toplamaIslemi(double a,double b)
            {
                  return (a+b);
            }

            private double cikarmaIslemi(double a,double b)
            {
                  return (a-b);
            }
           
            private double carpmaIslemi(double a,double b)
            {
                  return (a*b);
            }

            private double bolmeIslemi(double a,double b)
            {
                  return (a/b);
            }

            private double kuvvetIslemi(double a,double b)
            {
                  return Math.Pow(a,b);
            }

            private void islemYap(int islem)
            {
                  if(sonislemno==1)
                  {
                        double iki=Convert.ToDouble(sonuc.Text);
                        sonuc.Text=""+carpmaIslemi(ilk,iki);
                        sonislemno=islem;
                        sonbasilan=true;
                        nokt=false;
                        ilk=0.0;
                  }
                  else
                  if(sonislemno==2)
                  {
                        double iki=Convert.ToDouble(sonuc.Text);
                        if(iki==0.0)
                        {
                             //hata ver,0 a bolme hatasiii,sifirla
                        }    
                        else
                        {
                             sonuc.Text=""+bolmeIslemi(ilk,iki);
                             sonislemno=islem;
                             sonbasilan=true;
                             nokt=false;
                             ilk=0.0;
                        }
                  }
                  else
                  if(sonislemno==3)
                  {
                        double iki=Convert.ToDouble(sonuc.Text);
                        sonuc.Text=""+toplamaIslemi(ilk,iki);
                        sonislemno=islem;
                        sonbasilan=true;
                        nokt=false;
                        ilk=0.0;
                  }
                  else
                  if(sonislemno==4)
                  {
                        double iki=Convert.ToDouble(sonuc.Text);
                        sonuc.Text=""+cikarmaIslemi(ilk,iki);
                        sonislemno=islem;
                        sonbasilan=true;
                        nokt=false;
                        ilk=0.0;
                  }
                  else
                  if(sonislemno==5)
                  {
                        double iki=Convert.ToDouble(sonuc.Text);
                        sonuc.Text=""+kuvvetIslemi(ilk,iki);
                        sonislemno=islem;
                        sonbasilan=true;
                        nokt=false;
                        ilk=0.0;
                  }
                  if(islem>0)
                        ilk=Convert.ToDouble(sonuc.Text);
            }



      }

}