先判断加数和被加数无相等再去做加法,然后也是拆分成3位,用或运算做的,没用for循环,查到也可以填充到数组,利用数组的属性去做元素重复判断,但是没用过,就用笨一点的办法。最终数量不确定是不是包含最后一个空格,只是一个控件的行数。
bool b11 = (a == 0 | a == b | a == c | a == l | a == m | a == n | a == x | a == y | a == z);
bool b12 = (b == 0 | b == c | b == l | b == m | b == n | b == x | b == y | b == z);
bool b13 = (c == 0 | c == l | c == m | c == n | c == x | c == y | c == z);
bool b14 = (l == 0 | l == m | l == n | l == x | l == y | l == z);
bool b15 = (m == 0 | m == n | m == x | m == y | m == z);
bool b16 = (n == 0 | n == x | n == y | n == z);
bool b17 = (x == 0 | x == y | x == z);
bool b18 = (y == 0 | y == z);
bool b19 = (z == 0);
if (b11 | b12 | b13 | b14 | b15 | b16 | b17 | b18 | b19)
{
}
else
{
count = i.ToString() + "+" + j.ToString() + "=" + sum.ToString();
textBox1.AppendText(count + "\r\n");
}