//button √ private void BtnSquareRoot_Click(object sender, RoutedEventArgs e) { if (NoCalculationsYet == true) { //Converting the Current number which is inside the TbInputNumbers TextBlock //Adding the Current number to the Memory array,Incrementing the MemoryIndex by one //Storing the calculation in the result variable (Rounding the result) //Showing the user the given result in the TbResultmemory textBlock //We add the button's text to the TbCalculationProgress textblock //Adding the result to the Memory array and ResultMemory array //incrementing the Memory array's and ResultMemory array's index counter by one //Incrementing the navigator by one and setting the navigator on this side to the new value double CurrentNumber = Convert.ToDouble(TbInputNumbers.Text); Calculations.AddToMemory(CurrentNumber); Calculations.IncrementMemoryIndexByOne(); double Result = Calculations.SquareRootNumber(); Math.Round(Result, 10); TbResultMemory.Text = Result.ToString(); TbCalculationProgress.Text = "√" + CurrentNumber + ""; Calculations.AddToMemory(Result); Calculations.AddToResultMemory(Result); Calculations.IncrementResultMemoryIndexByOne(); Calculations.IncrementResultMemoryNavigatorByOne(); //Setting the NoCalculationsYet variable to false as we've just calculated the result NoCalculationsYet = false; } else if (NoCalculationsYet == false) { //Storing the previous element of the Memory array in the Previous number variable //Storing the calculation in the result variable (Rounding the result) //Showing the user the given result in the TbResultmemory textBlock //We add the button's text to the TbCalculationProgress textblock //Adding the result to the Memory array and ResultMemory array //incrementing the Memory array's and ResultMemory array's index counter by one //Incrementing the navigator by one and setting the navigator on this side to the new value Calculations.IncrementMemoryIndexByOne(); double PreviousNumber = Calculations.GiveBackPreviousElementOfMemory(); double Result = Calculations.SquareRootNumber(); Math.Round(Result, 10); TbResultMemory.Text = Result.ToString(); TbCalculationProgress.Text = "(" + PreviousNumber + " * " + PreviousNumber + ")"; Calculations.AddToMemory(Result); Calculations.AddToResultMemory(Result); Calculations.IncrementResultMemoryIndexByOne(); Calculations.IncrementResultMemoryNavigatorByOne(); } //Setting the UserCanDeleteLastNumber variable to false as the user cannot Delete back from the result UserCanDeleteLastNumber = false; //Setting this variable to false as the user can use division or multiplication, because the Memory array is not empty NewCalculation = false; //After the calculation this variable will always be one CalculationIsOnGoing = 1; //Setting the TbInputNumbers Textblock's text to default after every calculation TbInputNumbers.Text = "0"; }