Add C++ codes for the chapter

array and linked list.
This commit is contained in:
Yudong Jin
2022-11-27 19:07:35 +08:00
parent 19a4ccd86a
commit 731e98fc25
11 changed files with 705 additions and 44 deletions

View File

@ -67,6 +67,22 @@ class PrintUtil {
return os.str();
}
/**
* @brief Print an Array
*
* @tparam T
* @tparam n
*/
template<typename T>
static void printArray(T* arr, int n)
{
cout << "[";
for (size_t i = 0; i < n - 1; i++) {
cout << arr[i] << ", ";
}
cout << arr[n - 1] << "]" << '\n';
}
/**
* @brief Get the Vector String object
*