此函数初始化数组C [m + 1] [n + 1]和B [m] [n],并用零填充C的第一行和第一列。注意:int *** C指向一个指向2D整数数组的指针 示例:https://i.stack.imgur.com/ElWMY.png
void initLCSTable(int*** C, char*** B, int m, int n)
{
}
void printLengthTable(int** C, int m, int n);
void printArrowTable(char** B, int m, int n);
int main() {
std::string strX;
std::string strY;
cout << "String #1: ";
cin >> strX;
cout << "String #2: ";
cin >> strY;
int m = strX.length();
int n = strY.length();
//declare two dynamic 2-Dimensional array of variable length
//C is (m+1)X(n+1) and B is m X n
int** C;
char** B;
initLCSTable(&C, &B, m, n);
fillLCSTable(strX, strY, C, B);
cout << "\nThe LCS is: " << findLCS(strX, B, m, n) << endl;
cout << "Length = " << C[m][n] << endl;
cout << "\nTable C" << endl;
printLengthTable(C, m, n);
cout << "\nTable B" << endl;
printArrowTable(B, m, n);
freeLCSTable(C, B, m);
return 0;
}