如果我有如果陣列
int win[][] ={{1,2,3},{4,5,6},{7,8,9},{1,4,7},{2,5,8},{3,6,9},{1,5,9},{3,5,7}};
我可以把條件這樣的條件?
if(((win[0][0]) && (win[0][1]) && (win[0][2]))||
((win[1][0]) && (win[1][1]) && (win[1][2]))||
((win[2][0]) && (win[2][1]) && (win[2][2]))||
((win[3][0]) && (win[3][1]) && (win[3][2]))||
((win[4][0]) && (win[4][1]) && (win[4][2]))||
((win[5][0]) && (win[5][1]) && (win[5][2]))||
((win[6][0]) && (win[6][1]) && (win[6][2]))||
((win[7][0]) && (win[7][1]) && (win[7][2]))||
((win[8][0]) && (win[8][1]) && win[8][2])))
我不明白爲什麼不......不過你爲什麼會做這樣的說法?你有沒有考慮過循環每一組3? – James
你爲什麼不先試試自己? – Pratik