I am making a simple calculator in visual studio where I have put different buttons including a square button, square root button, cube button and cube root button in my winform calculator. All other button work fine in the calculator but I don't know the code behind the square, sqrt, cube and cube root button so can you suggest me some code that will help me solve the problem in my calculator?
Beginner Need some help
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Khargesh RajputRank #616 · 3.9K reputationPosted Apr 10, 2015, 8:00 PM EDT
Nitin Gaur181 reputationPosted Apr 10, 2015, 8:38 PM EDT
u can try my simple code to run that funtionality..
code for SQR : textBox2.Text = (Convert.ToInt32(textBox1.Text) * Convert.ToInt32(textBox1.Text)).ToString();
code for SQRT : textBox2.Text = Math.Sqrt( Convert.ToDouble( textBox1.Text)).ToString();
code for CUBE : textBox2.Text = (Convert.ToInt32(textBox1.Text) * Convert.ToInt32(textBox1.Text) * Convert.ToInt32(textBox1.Text)).ToString();
code for CUBEROOT: textBox2.Text = Math.Pow(Convert.ToDouble(textBox1.Text), 0.3333333333333333).ToString();
hope this will help you !!
Sam Jones8 reputationPosted Apr 12, 2015, 1:11 PM EDT
Sam Jones8 reputationPosted Apr 12, 2015, 1:12 PM EDT