Is there a way to change the for loop to something else and to any other loops. How
thanx for your help
float result = float.Parse(memory[0].ToString());
for (int i = 0; i < memory.Count; i++)
{
if (memory.ToString() == "+")
{
result += float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}
if (memory.ToString() == "-")
{
result -= float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}
if (memory.ToString() == "×")
{
result *= float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}
if (memory.ToString() == "÷")
{
result /= float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}
thanx for your help
float result = float.Parse(memory[0].ToString());
for (int i = 0; i < memory.Count; i++)
{
if (memory.ToString() == "+")
{
result += float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}
if (memory.ToString() == "-")
{
result -= float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}
if (memory.ToString() == "×")
{
result *= float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}
if (memory.ToString() == "÷")
{
result /= float.Parse(memory[i + 1].ToString());
TextResult.Text = result.ToString();
}