示例#1
0
        public async void RastgeleMatrisOlustur()
        {
            label4.Visible = true;
            label5.Visible = true;
            Random rastgele = new Random();
            int    satir    = rastgele.Next(1, 5);
            int    sutun    = rastgele.Next(1, 5);

            double[,] rastgeleMatris = new double[satir, sutun];

            for (int i = 0; i < satir; i++)
            {
                for (int j = 0; j < sutun; j++)
                {
                    int    sayi  = rastgele.Next(1, 9);
                    Button buton = new Button();
                    buton.Height   = 50;
                    buton.Width    = 50;
                    buton.Location = new System.Drawing.Point(100 + j * buton.Height + 5, 100 + i * buton.Width + 5);
                    buton.Name     = "btn-" + i + "-" + j.ToString();
                    buton.Text     = sayi.ToString();
                    // buton.Click += new System.EventHandler(this.boyutButtonClick);
                    this.Controls.Add(buton);
                    rastgeleMatris[i, j] = Convert.ToDouble(buton.Text.ToString());
                }
            }

            if (satir == sutun)
            {
                Metotlar metot = new Metotlar(this);
                double[,] birimmatris    = metot.BirimMatris(rastgeleMatris.GetLength(0));
                double[,] tersmatriskare = await metot.tersBulma(rastgeleMatris, birimmatris);

                lblToplamSayisi.Text = Metotlar.Toplamsayisi.ToString();
                lblCarpimSayisi.Text = Metotlar.CarpmaSayisi.ToString();
                //tersMatrisYazdir(tersmatriskare);
            }
            else
            {
                Metotlar metot = new Metotlar(this);
                double[,] transpoz      = metot.transpozAl(rastgeleMatris);
                double[,] carpimMatrisi = metot.matrisCarp(rastgeleMatris, transpoz);
                double[,] birimmatris   = metot.BirimMatris(carpimMatrisi.GetLength(0));
                double[,] tersmatris    = await metot.tersBulma(carpimMatrisi, birimmatris);

                lblToplamSayisi.Text = Metotlar.Toplamsayisi.ToString();
                lblCarpimSayisi.Text = Metotlar.CarpmaSayisi.ToString();
                //tersMatrisYazdir(tersmatris);
            }
        }
示例#2
0
        public async void ManuelMatrisOlustur(double[,] sayi, int satir, int sutun)
        {
            label4.Visible         = true;
            label5.Visible         = true;
            double[,] manuelMatris = new double[satir, sutun];
            for (int i = 0; i < satir; i++)
            {
                for (int j = 0; j < sutun; j++)
                {
                    Button buton = new Button();
                    buton.Height   = 50;
                    buton.Width    = 50;
                    buton.Location = new System.Drawing.Point(100 + j * buton.Height + 5, 100 + i * buton.Width + 5);
                    buton.Text     = sayi[i, j].ToString();
                    this.Controls.Add(buton);
                    manuelMatris[i, j] = Convert.ToDouble(buton.Text.ToString());
                }
            }
            if (satir == sutun)
            {
                Metotlar metot = new Metotlar(this);
                double[,] birimmatris    = metot.BirimMatris(manuelMatris.GetLength(0));
                double[,] tersmatriskare = await metot.tersBulma(manuelMatris, birimmatris);

                lblToplamSayisi.Text = Metotlar.Toplamsayisi.ToString();
                lblCarpimSayisi.Text = Metotlar.CarpmaSayisi.ToString();
                //tersMatrisYazdir(tersmatriskare);
            }
            else
            {
                Metotlar metot = new Metotlar(this);
                double[,] transpoz      = metot.transpozAl(manuelMatris);
                double[,] carpimMatrisi = metot.matrisCarp(manuelMatris, transpoz);
                double[,] birimmatris   = metot.BirimMatris(carpimMatrisi.GetLength(0));
                double[,] tersmatris    = await metot.tersBulma(carpimMatrisi, birimmatris);

                lblToplamSayisi.Text = Metotlar.Toplamsayisi.ToString();
                lblCarpimSayisi.Text = Metotlar.CarpmaSayisi.ToString();
                //tersMatrisYazdir(tersmatris);
            }
        }