コード例 #1
0
ファイル: AddNumbForm.cs プロジェクト: Punisher001/Labs
 private void addButton_Click(object sender, EventArgs e)
 {
     if (drobCheckBox.Checked == true)
     {
         DrobNumber x = new DrobNumber();
         x.Numerator   = Convert.ToDouble(maskedTextBox1.Text);
         x.Denominator = Convert.ToDouble(maskedTextBox2.Text);
         x.Transfer();
         MessageBox.Show("обьект создан его запись " + x.Count);
         Array.Resize(ref Main.Global.drb, Main.Global.drb.Length + 1);
         Main.Global.drb[Main.Global.drb.Length - 1] = x;
     }
     if (komplexCheckBox.Checked == true)
     {
         KomplexNumber x = new KomplexNumber();
         x.Exictedpart = Convert.ToDouble(maskedTextBox1.Text);
         x.Fakepart    = Convert.ToDouble(maskedTextBox2.Text);
         x.Transfer();
         MessageBox.Show("обьект создан его запись " + x.Count);
         Array.Resize(ref Main.Global.kmp, Main.Global.kmp.Length + 1);
         Main.Global.kmp[Main.Global.kmp.Length - 1] = x;
     }
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: Punisher001/Labs
        private void openToolStrip_Click(object sender, EventArgs e)
        {
            Number.count = 0;
            Global.drb   = new DrobNumber[0];
            Global.kmp   = new KomplexNumber[0];
            string[]     text;
            string       line = "";
            StreamReader sr   = new StreamReader("papka.txt");

            while ((line = sr.ReadLine()) != null)
            {
                text = line.Split(' ');
                if (text[0] == "drb")
                {
                    DrobNumber x = new DrobNumber();
                    x.Numerator   = Convert.ToInt16(text[2]);
                    x.Denominator = Convert.ToInt16(text[3]);
                    x.Count       = Convert.ToInt16(text[1]);
                    x.Transfer();
                    Array.Resize(ref Main.Global.drb, Main.Global.drb.Length + 1);
                    Main.Global.drb[Main.Global.drb.Length - 1] = x;
                }
                ;
                if (text[0] == "kmp")
                {
                    KomplexNumber x = new KomplexNumber();
                    x.Exictedpart = Convert.ToInt16(text[2]);
                    x.Fakepart    = Convert.ToInt16(text[3]);
                    x.Count       = Convert.ToInt16(text[1]);
                    x.Transfer();
                    Array.Resize(ref Main.Global.kmp, Main.Global.kmp.Length + 1);
                    Main.Global.kmp[Main.Global.kmp.Length - 1] = x;
                }
                ;
            }
        }