I'm new in C# and i'm trying to create a calculator. I'm storing a arithmetic operator in a string is there any way i can use the operator to solve the equation ?
My code :
else if (btn_name == "plus" || btn_name == "minus")
{
bol = true;
try
{
if (solve == "")
{
string num1 = Screen.Text;
first = float.Parse(num1);
second = first + second;
Screen.Text = second.ToString();
Screen_upper.Text = upper_text + text + " + ";
}
else
{
second = first (**#I want to use the operator here#**) second;
}
}
catch
{
Screen.Text = second.ToString();
Screen_upper.Text = upper_text + text + " + ";
}
solve = "+";
}