Esempio n. 1
0
 public override void WriterAddAttribute(XmlWriter writer)
 {
     writer.WriteAttributeString("FirstNumber", FirstNumber.ToString());
     writer.WriteAttributeString("LastNumber", LastNumber.ToString());
     writer.WriteAttributeString("StepNumber", StepNumber.ToString());
     base.WriterAddAttribute(writer);
 }
Esempio n. 2
0
        public void OnSelectNumber(object sender, EventArgs e)
        {
            if (CurrentState < 0)
            {
                CurrentState = CurrentState * -1;
            }

            Button clicked = (Button)sender;
            string number;

            if (CurrentState == 1)
            {
                number          = FirstNumber.ToString();
                number          = number + clicked.Text;
                FirstNumber     = double.Parse(number);
                ResultText.Text = FirstNumber.ToString();
            }
            else
            {
                number          = SecondNumber.ToString();
                number          = number + clicked.Text;
                SecondNumber    = double.Parse(number);
                ResultText.Text = SecondNumber.ToString();
            }
        }
Esempio n. 3
0
 void MaindataGrid_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
 {
     try
     {
         if (датаToolStripMenuItem.Checked)
         {
             DateTime FirstDate;
             DateTime SecondDate;
             DateTime.TryParse(e.CellValue1.ToString(), out FirstDate);
             DateTime.TryParse(e.CellValue2.ToString(), out SecondDate);
             e.SortResult = DateTime.Compare(FirstDate, SecondDate);
         }
         if (числоToolStripMenuItem.Checked)
         {
             int FirstNumber;
             int SecondNumber;
             int.TryParse(e.CellValue1.ToString(), out FirstNumber);
             int.TryParse(e.CellValue2.ToString(), out SecondNumber);
             e.SortResult = String.Compare(FirstNumber.ToString("00000000000"), SecondNumber.ToString("00000000000"), StringComparison.Ordinal);
         }
         if (текстпоУмолчаниюToolStripMenuItem.Checked)
         {
             e.SortResult = String.Compare(e.CellValue1.ToString(), e.CellValue2.ToString(), StringComparison.Ordinal);
         }
         e.Handled = true;
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
         LogManager.Log.AddToLog(AppDir, exc);
     }
 }
        /// <summary>
        /// Run backward counter on valid arguments
        /// </summary>
        /// <returns>Counter result if valid else return error</returns>
        public string PrintBackwardCount()
        {
            // List of backwardCount
            List <string> bakcwardCount = new List <string>();

            // Check if valid
            if (IsValid)
            {
                // First number is greater than 1 and First number is divisible by Second Number
                while ((FirstNumber > 1) && (FirstNumber % SecondNumber == 0))
                {
                    // Add First number to list
                    bakcwardCount.Add(FirstNumber.ToString());
                    // Deduct FirstNumber By SecondNumber
                    FirstNumber -= SecondNumber;
                }
            }
            else
            {
                // Return Error
                return("Error: " + Status);
            }
            // Join the list by space
            return(string.Join(" ", bakcwardCount));
        }
        void OnSelectNumber(object sender, EventArgs e)
        {
            Button button  = (Button)sender;
            string pressed = button.Text;

            if (Contador > 0)
            {
                acumulador.Append(pressed);
                SecondNumber           = Convert.ToDouble(acumulador.ToString());
                this.txtAcumulado.Text = this.txtAcumulado.Text + acumulador[acumulador.Length - 1];
            }
            else
            {
                acumulador.Append(pressed);
                FirstNumber            = Convert.ToDouble(acumulador.ToString());
                this.txtAcumulado.Text = FirstNumber.ToString();
            }
        }
Esempio n. 6
0
        public Questions(Difficulty difficulty)
        {
            this.Sign = User.operations;
            var x = GeneraterRandomNumber(difficulty);
            var y = GeneraterRandomNumber(difficulty);

            int[] arr = new int[2];

            arr = CheckIfEqual(x, y, difficulty);



            if (CheckAdd())
            {
                this.FirstNumber  = arr[0];
                this.SecondNumber = arr[1];
                this.QuestionAdd  = FirstNumber.ToString() + "+" + SecondNumber.ToString() + "=";
                this.Answer       = GetAnswer(Sign[0], FirstNumber, SecondNumber);
            }
            else if (CheckSubtract())
            {
                this.FirstNumber      = arr[0];
                this.SecondNumber     = arr[1];
                this.QuestionSubtract = FirstNumber.ToString() + "-" + SecondNumber.ToString() + "=";
                this.Answer           = GetAnswer(Sign[0], FirstNumber, SecondNumber);
            }
            else if (CheckMultiply())
            {
                //arr = CheckForDivide(arr, difficulty);
                this.FirstNumber      = arr[0];
                this.SecondNumber     = arr[1];
                this.QuestionMultiply = FirstNumber.ToString() + "X" + SecondNumber.ToString() + "=";
                this.Answer           = GetAnswer(Sign[0], FirstNumber, SecondNumber);
            }
            else if (CheckDivide())
            {
                arr = CheckForDivide(arr, difficulty);
                this.FirstNumber   = arr[0];
                this.SecondNumber  = arr[1];
                this.QuestionDivde = FirstNumber.ToString() + "÷" + SecondNumber.ToString() + "=";
                this.Answer        = GetAnswer(Sign[0], FirstNumber, SecondNumber);
            }
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            const double MAGIC_NUMBER = 7.777; // local variable that is a constant

            // Can't do this because it is a cosntant value MAGIC_NUMBER = 8;
            ClassLevelVariable = 8;

            double FirstNumber;
            double SecondNumber;
            double ThirdNumber;

            Console.WriteLine("Please enter first number");
            string answer1 = Console.ReadLine();

            FirstNumber = Convert.ToDouble(answer1);

            Console.WriteLine("Please enter second number");
            string answer2 = Console.ReadLine();

            SecondNumber = Convert.ToDouble(answer2);

            Console.WriteLine("Please enter third number");
            string answer3 = Console.ReadLine();

            ThirdNumber = Convert.ToDouble(answer3);



            double sum = FirstNumber + SecondNumber + ThirdNumber;

            Console.WriteLine("The result of " + FirstNumber.ToString("N3") + " + " +
                              SecondNumber.ToString("N3") + " + " + ThirdNumber.ToString("N3") + " = " + sum.ToString("N3"));


            double product = sum * MAGIC_NUMBER;

            Console.WriteLine("The result of " + sum.ToString("N") + " * " + MAGIC_NUMBER + " = " + product.ToString("N3"));
        }
Esempio n. 8
0
 // Function to return addition expression (in string) for the quiz
 public string Expression()
 {
     return(String.Format(EXPRESSION_FORMAT, FirstNumber.ToString(),
                          SecondNumber.ToString(), Output.ToString()));
 }
Esempio n. 9
0
 public override string ToString()
 {
     return("First number: " + FirstNumber.ToString() + "\n" +
            "Second number: " + SecondNumber.ToString() + "\n" +
            "Number in memory: " + NumberInMemory.ToString());
 }
Esempio n. 10
0
 /// <summary>
 /// Provides a <see cref="string"/> representation of this instance.
 /// </summary>
 /// <returns><see cref="String"/> representation of this instance.</returns>
 public override string ToString() =>
 string.Format("{0} - {1}", Family,
               (IsWind ? Tiles.First().Wind.Value.ToString() :
                (IsDragon ? Tiles.First().Dragon.Value.ToString() :
                 FirstNumber.ToString())));