我试图用联合声明来描述 C++ 中的数独板:
union Board
{
int board[9][9];
int sec1[3][3];
int sec2[3][3];
int sec3[3][3];
int sec4[3][3];
int sec5[3][3];
int sec6[3][3];
int sec7[3][3];
int sec8[3][3];
int sec9[3][3];
}
电路板的每个部分是否与阵列的正确部分相对应?IE,
sec4 会与 board[4-6][0-3] 对应吗?有没有更好的方法来做这种事情(特别是描述数独板)?