先判斷加數(shù)和被加數(shù)無相等再去做加法,然后也是拆分成3位,用或運算做的,沒用for循環(huán),查到也可以填充到數(shù)組,利用數(shù)組的屬性去做元素重復判斷,但是沒用過,就用笨一點的辦法。最終數(shù)量不確定是不是包含最后一個空格,只是一個控件的行數(shù)。
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");
}