Beispiel #1
0
        public static bool ComparisonDD(TextBox t, int s, Label ErrorMSlb, LinkButton LinkExlbl)
        {
            string str = BinaryOperation.ConvertToDD(s, 4);

            if (t.Text != str)
            {
                FalseAnsw(t);
                if (t.Text[1] != str[0] && t.Text[2] != ',')
                {
                    ErrorMSlb.Text += " Не правильно вказаний знак.";
                }
                else
                {
                    ErrorMSlb.Text += " Помилка в значущих розрядах.";
                }
                if (t.Text == BinaryOperation.ConvertToZV(s, 4))
                {
                    ErrorMSlb.Text += " Можливо не врахована одиниця доповнення.";
                }

                LinkExlbl.Text = "При виникненні труднощів в обчисленні ви можете ознайомитись з теорією виконання " +
                                 "арифметичних операції з двійковими числами. Для цього натисніть по даному посиланні";
                return(false);
            }
            else
            {
                TrueAnsw(t);
                return(true);
            }
        }
        void TraslateTo(int InpDigit)
        {
            switch (SCHDDL.SelectedItem.Value)
            {
            case "2":
                TresTranslate.Text = BinaryOperation.DelZNK(ConvertDigit.ConvertToBIN(InpDigit));
                break;

            case "8":
                TresTranslate.Text = ConvertDigit.ConvertToOCT(InpDigit);
                break;

            case "10":
                TresTranslate.Text = ConvertDigit.ConvertToDEC(InpDigit);
                break;

            case "16":
                TresTranslate.Text = ConvertDigit.ConvertToHEX(InpDigit);
                break;
            }
        }
Beispiel #3
0
 public static string ConvertToBIN(int a)
 {
     return(BinaryOperation.ravenstvo(a));
 }
Beispiel #4
0
 public static string ConvertToBIN(string a)
 {
     return(BinaryOperation.ravenstvo(Convert.ToInt32(a)));
 }
        protected void TranslateBtn_Click(object sender, EventArgs e)
        {
            TinputSCH.BorderStyle = BorderStyle.None;
            TinputSCH.BorderColor = Color.White;
            Trnsltlbl.Visible     = false;
            int InpDigit = 0;

            if (!string.IsNullOrEmpty(TinputSCH.Text))
            {
                switch (SCHDDL0.SelectedItem.Value)
                {
                case "2":
                    try
                    {
                        InpDigit = Convert.ToInt32(BinaryOperation.DelZNK(TinputSCH.Text), 2);
                        TraslateTo(InpDigit);
                    }
                    catch
                    {
                        CatchNONWR();
                    }
                    break;

                case "8":
                    try
                    {
                        InpDigit = Convert.ToInt32(TinputSCH.Text, 8);
                        TraslateTo(InpDigit);
                    }
                    catch
                    {
                        CatchNONWR();
                    }
                    break;

                case "10":
                    try
                    {
                        InpDigit = Convert.ToInt32(TinputSCH.Text);
                        TraslateTo(InpDigit);
                    }
                    catch
                    {
                        CatchNONWR();
                    }
                    break;

                case "16":
                    try
                    {
                        InpDigit = Convert.ToInt32(TinputSCH.Text, 16);
                        TraslateTo(InpDigit);
                    }
                    catch
                    {
                        CatchNONWR();
                    }
                    break;
                }
            }
        }