private void equal_Click(object sender, EventArgs e)
 {
     while (true)
     {
         if (PEMDAS.checkforZero(n) == true)
         {
             MessageBox.Show("Error: Cannot be divided by zero");
             break;
         }
         if (output_screen.Text != String.Empty)
         {
             res = PEMDAS.equal_function(n);
             addOutputscreen(n + " = ");
             hist_list.Text = "\n" + output_screen.Text.Substring(0, output_screen.TextLength - 3) + "\n= " + res.ToString() + "\n" + hist_list.Text;
             ioScreen.Text  = res.ToString();
             prev_res       = res;
             PEMDAS.ops.Clear();
             PEMDAS.nums.Clear();
             output_screen.Text = String.Empty;
             n       = "";
             op_actv = true;
         }
         else
         {
             res            = double.Parse(ioScreen.Text);
             prev_res       = res;
             hist_list.Text = "\n" + "\n= " + res + hist_list.Text;
             n = "";
         }
         break;
     }
 }
 private void reciprocal_Click(object sender, EventArgs e)
 {
     if (ioScreen.Text != "" && ioScreen.Text != "0")
     {
         n              = PEMDAS.other_ops(n, "reciprocal");
         ioScreen.Text  = String.Empty;
         ioScreen.Text += n;
     }
 }
 //Other Events
 private void sqr_function_Click(object sender, EventArgs e)
 {
     if (ioScreen.Text != "" && ioScreen.Text != "0")
     {
         n              = PEMDAS.other_ops(n, "sqr");
         ioScreen.Text  = String.Empty;
         ioScreen.Text += n;
     }
 }
 private void percent_Click(object sender, EventArgs e)
 {
     if (PEMDAS.nums.Count != 0)
     {
         n              = PEMDAS.other_ops(n, "percent");
         ioScreen.Text  = String.Empty;
         ioScreen.Text += n;
         equal.PerformClick();
     }
 }
 private void ops_Click(string num, string op)
 {
     if (op_actv == false)
     {
         if (ioScreen.Text != "" || n != "") //As to not make an error when ioScreen.Text is empty
         {
             nth++;
             PEMDAS.add_num(double.Parse(num));
             PEMDAS.add_ops(op);
             addOutputscreen(num + " " + op + " ");
             n       = "";
             op_actv = true;
         }
     }
 }