mirror of
https://github.com/kangjianwei/Data-Structure.git
synced 2026-08-18 01:10:14 +08:00
♻️ 更新PressEnterToContinue函数
This commit is contained in:
@@ -23,7 +23,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化顺序表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 不为空!\n");
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -44,7 +44,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(&L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -52,7 +52,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
@@ -60,7 +60,7 @@ int main(int argc, char** argv) {
|
||||
i = ListLength(L);
|
||||
printf("█ L 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -79,7 +79,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -87,7 +87,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, 4, &e);
|
||||
printf("█ L 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char** argv) {
|
||||
i = LocateElem(L, 7, CmpGreater);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", L.elem[i - 1]);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -142,7 +142,7 @@ int main(int argc, char** argv) {
|
||||
printf(" L 不为空!\n");
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char** argv) {
|
||||
printf(" L 不存在!!\n");
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "Status.h" //**▲01 绪论**//
|
||||
#include "SqList.h" //**▲02 线性表**//
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法2.1 ████████
|
||||
*
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "MergeSqList.h" //**▲02 线性表**//
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法2.2 ████████
|
||||
*
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "SqList.h" //**▲02 线性表**//
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法2.2 ████████
|
||||
*
|
||||
|
||||
@@ -23,14 +23,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化单链表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(L) ? printf("█ L 为空!!\n") : printf("█ L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -48,14 +48,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ L 的长度为 %d \n", ListLength(L));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -74,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, 4, &e);
|
||||
printf("█ L 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, i, &e);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -104,7 +104,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 L 后:");
|
||||
ListEmpty(L) ? printf(" L 为空!!\n") : printf(" L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 L 后:");
|
||||
L ? printf(" L 存在!\n") : printf(" L 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateList_Head \n");
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 头插法建立单链表 L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateList_Tail \n");
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 尾插法建立单链表 L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化单链表 S ...\n");
|
||||
InitList(space, &S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(space, S) ? printf("█ S 为空!!\n") : printf("█ S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -42,7 +42,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(space, S, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -50,14 +50,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ S 中的元素为:S = ");
|
||||
ListTraverse(space, S, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ S 的长度为 %d \n", ListLength(space, S));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -76,7 +76,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:S = ");
|
||||
ListTraverse(space, S, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -84,7 +84,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(space, S, 4, &e);
|
||||
printf("█ S 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -93,7 +93,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(space, S, i, &e);
|
||||
printf("█ S 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -132,7 +132,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 S 后:");
|
||||
ListEmpty(space, S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -145,7 +145,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 S 后:");
|
||||
S!=0 ? printf(" S 存在!\n") : printf(" S 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化双向循环链表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(L) ? printf("█ L 为空!!\n") : printf("█ L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -48,14 +48,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ L 的长度为 %d \n", ListLength(L));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -74,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, 4, &e);
|
||||
printf("█ L 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, i, &e);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -104,7 +104,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 L 后:");
|
||||
ListEmpty(L) ? printf(" L 为空!!\n") : printf(" L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 L 后:");
|
||||
L ? printf(" L 存在!\n") : printf(" L 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化扩展的线性链表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(L) ? printf("█ L 为空!!\n") : printf("█ L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(&L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -49,14 +49,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ L 的长度为 %d \n", ListLength(L));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -75,7 +75,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -83,7 +83,7 @@ int main(int argc, char** argv) {
|
||||
r = LocateElem(L, 7, CmpGreater);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", r->data);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -96,7 +96,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", r->data);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -109,7 +109,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", r->data);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ MakeNode \n");
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 创建结点 \"300\" ...\n");
|
||||
MakeNode(&s, 300);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsFirst \n");
|
||||
@@ -131,7 +131,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DelFirst \n");
|
||||
@@ -142,7 +142,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsBefore \n");
|
||||
@@ -154,7 +154,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsAfter \n");
|
||||
@@ -166,7 +166,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Append \n");
|
||||
@@ -179,7 +179,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Remove \n");
|
||||
@@ -190,7 +190,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -203,7 +203,7 @@ int main(int argc, char** argv) {
|
||||
printf("清空 L 后:");
|
||||
ListEmpty(L) ? printf(" L 为空!!\n") : printf(" L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -217,7 +217,7 @@ int main(int argc, char** argv) {
|
||||
L.head != NULL && L.tail != NULL ? printf(" L 存在!\n") : printf(" L 不存在!!\n");
|
||||
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ int main(int argc, char **argv) {
|
||||
printf("█ 作为示范,创建项数为 %d 的多项式Pb...\n", n);
|
||||
CreatPolyn(&Pb, n, "TestData_Pb.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintPolyn \n");
|
||||
@@ -26,14 +26,14 @@ int main(int argc, char **argv) {
|
||||
printf("█ 一元多项式 Pb = ");
|
||||
PrintPolyn(Pb);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PolynLength \n");
|
||||
{
|
||||
printf("█ La 的项数为 %d ,Lb 的项数为 %d\n", PolynLength(Pa), PolynLength(Pb));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ AddPolyn \n");
|
||||
@@ -46,7 +46,7 @@ int main(int argc, char **argv) {
|
||||
printf("█ Pa = Pa + Pb = ");
|
||||
PrintPolyn(Pa);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ SubtractPolyn \n");
|
||||
@@ -59,7 +59,7 @@ int main(int argc, char **argv) {
|
||||
printf("█ Pa = Pa - Pb = ");
|
||||
PrintPolyn(Pa);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ MultiplyPolyn \n");
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
|
||||
printf("█ Pa = Pa * Pb = ");
|
||||
PrintPolyn(Pa);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#include "SqStack.h" //**▲03 栈和队列**//
|
||||
|
||||
// 测试函数,打印元素
|
||||
void PrintElem(SElemType e);
|
||||
void PrintElem(SElemType e) {
|
||||
printf("%d ", e);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
SqStack S;
|
||||
@@ -14,13 +17,13 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化顺序栈 S ...\n");
|
||||
InitStack(&S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 StackEmpty \n");
|
||||
{
|
||||
StackEmpty(S) ? printf("█ S 为空!!\n") : printf("█ S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 Push \n");
|
||||
{
|
||||
@@ -29,21 +32,21 @@ int main(int argc, char** argv) {
|
||||
printf("█ 将 \"%2d\" 压入栈 S ...\n", 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 StackTraverse \n");
|
||||
{
|
||||
printf("█ S 中的元素为:S = ");
|
||||
StackTraverse(S, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 StackLength \n");
|
||||
{
|
||||
i = StackLength(S);
|
||||
printf("█ S 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 Pop \n");
|
||||
{
|
||||
@@ -52,14 +55,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ S 中的元素为:S = ");
|
||||
StackTraverse(S, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GetTop \n");
|
||||
{
|
||||
GetTop(S, &e);
|
||||
printf("█ 栈顶元素的值为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 ClearStack \n");
|
||||
{
|
||||
@@ -71,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 S 后:");
|
||||
StackEmpty(S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DestroyStack \n");
|
||||
{
|
||||
@@ -83,12 +86,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 S 后:");
|
||||
S.base != NULL && S.top != NULL ? printf(" S 存在!\n") : printf(" S 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 测试函数,打印元素
|
||||
void PrintElem(SElemType e) {
|
||||
printf("%d ", e);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
|
||||
#include "Hanoi.h" //**03 栈和队列**//
|
||||
|
||||
/* 全局变量 */
|
||||
Tower T; // 汉诺塔
|
||||
int gStep; // 统计移动步数
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法3.5 ████████
|
||||
*
|
||||
|
||||
@@ -19,12 +19,6 @@ typedef struct {
|
||||
int high[3]; // 三座塔的高度(持有的盘子数量)
|
||||
} Tower;
|
||||
|
||||
// 汉诺塔
|
||||
Tower T;
|
||||
|
||||
// 统计移动步数
|
||||
int gStep;
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法3.5 ████████
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#include "LinkQueue.h" //**03 栈和队列**//
|
||||
|
||||
// 测试函数,打印整型
|
||||
void PrintElem(QElemType e);
|
||||
void PrintElem(QElemType e) {
|
||||
printf("%d ", e);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
LinkQueue Q;
|
||||
@@ -14,13 +17,13 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化链队 Q ...\n");
|
||||
InitQueue(&Q);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 QueueEmpty \n");
|
||||
{
|
||||
QueueEmpty(Q) ? printf("█ Q 为空!!\n") : printf("█ Q 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 EnQueue \n");
|
||||
{
|
||||
@@ -29,21 +32,21 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%2d\" 入队...\n", 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 QueueTraverse \n");
|
||||
{
|
||||
printf("█ Q 中的元素为:Q = ");
|
||||
QueueTraverse(Q, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 QueueLength \n");
|
||||
{
|
||||
i = QueueLength(Q);
|
||||
printf("█ Q 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DeQueue \n");
|
||||
{
|
||||
@@ -52,14 +55,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q 中的元素为:Q = ");
|
||||
QueueTraverse(Q, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GetHead \n");
|
||||
{
|
||||
GetHead(Q, &e);
|
||||
printf("█ 队头元素的值为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 ClearQueue \n");
|
||||
{
|
||||
@@ -71,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 Q 后:");
|
||||
QueueEmpty(Q) ? printf(" Q 为空!!\n") : printf(" Q 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DestroyQueue \n");
|
||||
{
|
||||
@@ -83,12 +86,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 Q 后:");
|
||||
Q.front != NULL && Q.rear != NULL ? printf(" Q 存在!\n") : printf(" Q 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 测试函数,打印整型
|
||||
void PrintElem(QElemType e) {
|
||||
printf("%d ", e);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#include "SqQueue.h" //**▲03 栈和队列**//
|
||||
|
||||
// 测试函数,打印整型
|
||||
void PrintElem(QElemType e);
|
||||
void PrintElem(QElemType e) {
|
||||
printf("%d ", e);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
SqQueue Q;
|
||||
@@ -14,13 +17,13 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化循环顺序队列 Q ...\n");
|
||||
InitQueue(&Q);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 QueueEmpty \n");
|
||||
{
|
||||
QueueEmpty(Q) ? printf("█ Q 为空!!\n") : printf("█ Q 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 EnQueue \n");
|
||||
{
|
||||
@@ -29,21 +32,21 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%2d\" 入队Q...\n", 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 QueueTraverse \n");
|
||||
{
|
||||
printf("█ Q 中的元素为:Q = ");
|
||||
QueueTraverse(Q, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 QueueLength \n");
|
||||
{
|
||||
i = QueueLength(Q);
|
||||
printf("█ Q 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DeQueue \n");
|
||||
{
|
||||
@@ -52,14 +55,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q 中的元素为:Q = ");
|
||||
QueueTraverse(Q, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GetHead \n");
|
||||
{
|
||||
GetHead(Q, &e);
|
||||
printf("█ 队头元素的值为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 ClearQueue \n");
|
||||
{
|
||||
@@ -71,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 Q 后:");
|
||||
QueueEmpty(Q) ? printf(" Q 为空!!\n") : printf(" Q 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DestroyQueue \n");
|
||||
{
|
||||
@@ -83,12 +86,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 Q 后:");
|
||||
Q.base != NULL ? printf(" Q 存在!\n") : printf(" Q 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 测试函数,打印整型
|
||||
void PrintElem(QElemType e) {
|
||||
printf("%d ", e);
|
||||
}
|
||||
|
||||
@@ -9,13 +9,24 @@
|
||||
|
||||
#include "BankQueuing.h" //**▲03 栈和队列**//
|
||||
|
||||
/* 全局变量(变量名称前面都加了g标记) */
|
||||
int gTotalTime; // 累计客户数
|
||||
int gCustomerNum; // 累计客户逗留时间
|
||||
|
||||
int gCloseTime; // 关门时间,假设银行每天营业8小时,480分
|
||||
|
||||
EventList gEv; // 事件表,存储所有待处理事件
|
||||
Event gEn; // 当前正在处理的事件
|
||||
|
||||
LinkQueue gQ[N+1]; // 4个客户队列,0号单元弃用
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法3.6 ████████
|
||||
*
|
||||
* 银行业务模拟,统计一天内客户在银行逗留的平均时间
|
||||
*/
|
||||
void Bank_Simulation_1()
|
||||
{
|
||||
void Bank_Simulation_1() {
|
||||
char eventType;
|
||||
|
||||
OpenForDay(); // 银行开门
|
||||
@@ -165,7 +176,7 @@ void CustomerArrived() {
|
||||
|
||||
// 当前客户进入最短队列排队
|
||||
EnQueue(&gQ[i], customer);
|
||||
printf("第%3d个客户到队列 %d 中排队...\n", customer.Count, i);
|
||||
printf("第%3d个客户到柜台 %d 中排队...\n", customer.Count, i);
|
||||
Show();
|
||||
|
||||
/*
|
||||
@@ -189,7 +200,7 @@ void CustomerDeparture() {
|
||||
|
||||
// 第i个队列的队头客户完成业务并出队
|
||||
DeQueue(&gQ[i], &customer);
|
||||
printf("第%3d个客户从队列 %d 中离开...\n", customer.Count, i);
|
||||
printf("第%3d个客户从柜台 %d 中离开...\n", customer.Count, i);
|
||||
Show();
|
||||
|
||||
// 累计客户逗留时间
|
||||
@@ -308,16 +319,16 @@ void Show() {
|
||||
for(p = gQ[i].front; p; p = p->next) {
|
||||
if(p == gQ[i].front) {
|
||||
if(i == 1) {
|
||||
printf("柜台①●");
|
||||
printf("柜台⑴●");
|
||||
}
|
||||
if(i == 2) {
|
||||
printf("柜台②●");
|
||||
printf("柜台⑵●");
|
||||
}
|
||||
if(i == 3) {
|
||||
printf("柜台③●");
|
||||
printf("柜台⑶●");
|
||||
}
|
||||
if(i == 4) {
|
||||
printf("柜台④●");
|
||||
printf("柜台⑷●");
|
||||
}
|
||||
} else {
|
||||
printf("(%03d)", p->data.Count);
|
||||
|
||||
@@ -23,17 +23,6 @@
|
||||
/* 类型定义 */
|
||||
typedef LinkList EventList; //事件链表类型,定义为有序链表
|
||||
|
||||
/* 全局变量(变量名称前面都加了g标记) */
|
||||
int gTotalTime; // 累计客户数
|
||||
int gCustomerNum; // 累计客户逗留时间
|
||||
|
||||
int gCloseTime; // 关门时间,假设银行每天营业8小时,480分
|
||||
|
||||
EventList gEv; // 事件表,存储所有待处理事件
|
||||
Event gEn; // 当前正在处理的事件
|
||||
|
||||
LinkQueue gQ[N+1]; // 4个客户队列,0号单元弃用
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法3.6 ████████
|
||||
|
||||
@@ -2,7 +2,16 @@
|
||||
#include "SString.h" //**▲04 串**//
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(SString S);
|
||||
void PrintElem(SString S) {
|
||||
int i;
|
||||
|
||||
for(i = 1; i <= S[0]; i++) {
|
||||
printf("%c", S[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* chars = "01234567899876543210";
|
||||
@@ -16,20 +25,20 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrEmpty \n");
|
||||
{
|
||||
StrEmpty(S) ? printf("█ S 为空!!\n") : printf("█ S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrLength \n");
|
||||
{
|
||||
i = StrLength(S);
|
||||
printf("█ S 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCopy \n");
|
||||
{
|
||||
@@ -38,7 +47,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ T = ");
|
||||
PrintElem(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCompare \n");
|
||||
{
|
||||
@@ -46,7 +55,7 @@ int main(int argc, char** argv) {
|
||||
i = StrCompare(S, T);
|
||||
i == 0 ? printf("█ S==T\n") : (i < 0 ? printf("█ S<T\n") : printf("█ S>T\n"));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrInsert \n");
|
||||
{
|
||||
@@ -56,7 +65,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Index \n");
|
||||
{
|
||||
@@ -65,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
i = Index_1(S, T, 1);
|
||||
printf("█ 串 \"*****\" 在 S 中第一次出现的位置为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ SubString \n");
|
||||
{
|
||||
@@ -74,7 +83,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Sub = ");
|
||||
PrintElem(sub);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Replace \n");
|
||||
{
|
||||
@@ -85,7 +94,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrDelete \n");
|
||||
{
|
||||
@@ -94,7 +103,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ ClearString \n");
|
||||
{
|
||||
@@ -106,7 +115,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 S 后:");
|
||||
StrEmpty(S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Concat \n");
|
||||
{
|
||||
@@ -120,18 +129,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Tmp = ");
|
||||
PrintElem(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(SString S) {
|
||||
int i;
|
||||
|
||||
for(i = 1; i <= S[0]; i++) {
|
||||
printf("%c", S[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,16 @@
|
||||
#include "HString.h" //**▲04 串**//
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(HString S);
|
||||
void PrintElem(HString S) {
|
||||
int i;
|
||||
|
||||
for(i = 0; i <= S.length-1; i++) {
|
||||
printf("%c", S.ch[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* chars = "01234567899876543210";
|
||||
@@ -16,20 +25,20 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrEmpty \n");
|
||||
{
|
||||
StrEmpty(S) ? printf("█ S 为空!!\n") : printf("█ S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrLength \n");
|
||||
{
|
||||
i = StrLength(S);
|
||||
printf("█ S 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCopy \n");
|
||||
{
|
||||
@@ -38,7 +47,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ T = ");
|
||||
PrintElem(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCompare \n");
|
||||
{
|
||||
@@ -46,7 +55,7 @@ int main(int argc, char** argv) {
|
||||
i = StrCompare(S, T);
|
||||
i == 0 ? printf("█ S==T\n") : (i < 0 ? printf("█ S<T\n") : printf("█ S>T\n"));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrInsert \n");
|
||||
{
|
||||
@@ -56,7 +65,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Index \n");
|
||||
{
|
||||
@@ -65,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
i = Index(S, T, 1);
|
||||
printf("█ 串 \"*****\" 在 S 中第一次出现的位置为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ SubString \n");
|
||||
{
|
||||
@@ -74,7 +83,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Sub = ");
|
||||
PrintElem(sub);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Replace \n");
|
||||
{
|
||||
@@ -85,7 +94,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrDelete \n");
|
||||
{
|
||||
@@ -94,7 +103,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ ClearString \n");
|
||||
{
|
||||
@@ -106,7 +115,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 S 后:");
|
||||
StrEmpty(S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Concat \n");
|
||||
{
|
||||
@@ -120,18 +129,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Tmp = ");
|
||||
PrintElem(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(HString S) {
|
||||
int i;
|
||||
|
||||
for(i = 0; i <= S.length-1; i++) {
|
||||
printf("%c", S.ch[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -1,129 +1,5 @@
|
||||
#include "LString.h" //**▲04 串**//
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(LString S);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* chars = "01234567899876543210";
|
||||
LString S, T, sub, V;
|
||||
int i;
|
||||
|
||||
printf("████████ StrAssign \n");
|
||||
{
|
||||
printf("█ 为块链串 S 赋值...\n");
|
||||
StrAssign(&S, chars);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ StrEmpty \n");
|
||||
{
|
||||
StrEmpty(S) ? printf("█ S 为空!!\n") : printf("█ S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ StrLength \n");
|
||||
{
|
||||
i = StrLength(S);
|
||||
printf("█ S 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ StrCopy \n");
|
||||
{
|
||||
printf("█ 复制 S 到 T ...\n");
|
||||
StrCopy(&T, S);
|
||||
printf("█ T = ");
|
||||
PrintElem(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ StrCompare \n");
|
||||
{
|
||||
printf("█ 比较字符串 S 和 T ...\n");
|
||||
i = StrCompare(S, T);
|
||||
i == 0 ? printf("█ S==T\n") : (i < 0 ? printf("█ S<T\n") : printf("█ S>T\n"));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ StrInsert \n");
|
||||
{
|
||||
StrAssign(&T, "*****");
|
||||
printf("█ 将 \"*****\" 插入到串 S 的第 11 个位置处... \n");
|
||||
StrInsert(&S, 11, T);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ Index \n");
|
||||
{
|
||||
StrAssign(&T, "*****");
|
||||
printf("█ 获取 \"*****\" 在串 S 中的第一次出现的位置...\n");
|
||||
i = Index(S, T, 1);
|
||||
printf("█ 串 \"*****\" 在 S 中第一次出现的位置为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ SubString \n");
|
||||
{
|
||||
printf("█ 用 sub 返回 S 中第 11 个字符起的 5 个字符...\n");
|
||||
SubString(&sub, S, 11, 5);
|
||||
printf("█ Sub = ");
|
||||
PrintElem(sub);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ Replace \n");
|
||||
{
|
||||
StrAssign(&T, "*****");
|
||||
StrAssign(&V, "#####@@@@@");
|
||||
printf("█ 用 \"#####@@@@@\" 替换S中的 \"*****\" ...\n");
|
||||
Replace(&S, T, V);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ StrDelete \n");
|
||||
{
|
||||
printf("█ 删除 S 中第 16 个字符起的 5 个字符...\n");
|
||||
StrDelete(&S, 16, 5);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ ClearString \n");
|
||||
{
|
||||
printf("█ 清空 S 前:");
|
||||
StrEmpty(S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
|
||||
ClearString(&S);
|
||||
|
||||
printf("█ 清空 S 后:");
|
||||
StrEmpty(S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
printf("████████ Concat \n");
|
||||
{
|
||||
LString Tmp, S1, S2;
|
||||
|
||||
StrAssign(&S1, "+++++");
|
||||
StrAssign(&S2, "-----");
|
||||
|
||||
printf("█ 联接 \"+++++\" 和 \"-----\" 形成 Tmp ...\n");
|
||||
Concat(&Tmp, S1, S2);
|
||||
printf("█ Tmp = ");
|
||||
PrintElem(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(LString S) {
|
||||
int i = 0;
|
||||
@@ -150,3 +26,125 @@ void PrintElem(LString S) {
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* chars = "01234567899876543210";
|
||||
LString S, T, sub, V;
|
||||
int i;
|
||||
|
||||
printf("████████ StrAssign \n");
|
||||
{
|
||||
printf("█ 为块链串 S 赋值...\n");
|
||||
StrAssign(&S, chars);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrEmpty \n");
|
||||
{
|
||||
StrEmpty(S) ? printf("█ S 为空!!\n") : printf("█ S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrLength \n");
|
||||
{
|
||||
i = StrLength(S);
|
||||
printf("█ S 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCopy \n");
|
||||
{
|
||||
printf("█ 复制 S 到 T ...\n");
|
||||
StrCopy(&T, S);
|
||||
printf("█ T = ");
|
||||
PrintElem(T);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCompare \n");
|
||||
{
|
||||
printf("█ 比较字符串 S 和 T ...\n");
|
||||
i = StrCompare(S, T);
|
||||
i == 0 ? printf("█ S==T\n") : (i < 0 ? printf("█ S<T\n") : printf("█ S>T\n"));
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrInsert \n");
|
||||
{
|
||||
StrAssign(&T, "*****");
|
||||
printf("█ 将 \"*****\" 插入到串 S 的第 11 个位置处... \n");
|
||||
StrInsert(&S, 11, T);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Index \n");
|
||||
{
|
||||
StrAssign(&T, "*****");
|
||||
printf("█ 获取 \"*****\" 在串 S 中的第一次出现的位置...\n");
|
||||
i = Index(S, T, 1);
|
||||
printf("█ 串 \"*****\" 在 S 中第一次出现的位置为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ SubString \n");
|
||||
{
|
||||
printf("█ 用 sub 返回 S 中第 11 个字符起的 5 个字符...\n");
|
||||
SubString(&sub, S, 11, 5);
|
||||
printf("█ Sub = ");
|
||||
PrintElem(sub);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Replace \n");
|
||||
{
|
||||
StrAssign(&T, "*****");
|
||||
StrAssign(&V, "#####@@@@@");
|
||||
printf("█ 用 \"#####@@@@@\" 替换S中的 \"*****\" ...\n");
|
||||
Replace(&S, T, V);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrDelete \n");
|
||||
{
|
||||
printf("█ 删除 S 中第 16 个字符起的 5 个字符...\n");
|
||||
StrDelete(&S, 16, 5);
|
||||
printf("█ S = ");
|
||||
PrintElem(S);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ ClearString \n");
|
||||
{
|
||||
printf("█ 清空 S 前:");
|
||||
StrEmpty(S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
|
||||
ClearString(&S);
|
||||
|
||||
printf("█ 清空 S 后:");
|
||||
StrEmpty(S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Concat \n");
|
||||
{
|
||||
LString Tmp, S1, S2;
|
||||
|
||||
StrAssign(&S1, "+++++");
|
||||
StrAssign(&S2, "-----");
|
||||
|
||||
printf("█ 联接 \"+++++\" 和 \"-----\" 形成 Tmp ...\n");
|
||||
Concat(&Tmp, S1, S2);
|
||||
printf("█ Tmp = ");
|
||||
PrintElem(Tmp);
|
||||
}
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
#include "KMP.h" //**▲04 串**//
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(SString S);
|
||||
void PrintElem(SString S) {
|
||||
int i;
|
||||
|
||||
for(i = 1; i <= S[0]; i++) {
|
||||
printf("%c", S[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* s = "abaaabcaabaabcacabaabcaabaabcac";
|
||||
@@ -51,14 +60,3 @@ int main(int argc, char** argv) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 测试函数,打印字符串
|
||||
void PrintElem(SString S) {
|
||||
int i;
|
||||
|
||||
for(i = 1; i <= S[0]; i++) {
|
||||
printf("%c", S[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化一个维度为<2,3,4>的三维数组 A ...\n");
|
||||
InitArray(&A, 3, 2, 3, 4);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 Assign \n");
|
||||
@@ -78,7 +78,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ A = ");
|
||||
ArrayPrint(A);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 Value \n");
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char** argv) {
|
||||
Value(A, &x, 1, 1, 1);
|
||||
printf("█ A[1][1][1] = %d\n", x);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 DestroyArray \n");
|
||||
@@ -102,7 +102,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 A 后:");
|
||||
A.dim != 0 ? printf(" A 存在!\n") : printf(" A 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ int main(int argc, char** argv) {
|
||||
CreateSMatrix(&M, "TestData_M.txt");
|
||||
CreateSMatrix(&N, "TestData_N.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 PrintSMatrix \n");
|
||||
@@ -21,7 +21,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ N = \n");
|
||||
PrintSMatrix(N);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 CopySMatrix \n");
|
||||
@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Tmp = \n");
|
||||
PrintSMatrix(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 AddSMatrix \n");
|
||||
@@ -46,7 +46,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q1 = M + N = \n");
|
||||
PrintSMatrix(Q1);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 SubSMatrix \n");
|
||||
@@ -58,7 +58,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q2 = M - N = \n");
|
||||
PrintSMatrix(Q2);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 MultSMatrix \n");
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q3 = M * N = \n");
|
||||
PrintSMatrix(Q3);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 TransposeSMatrix \n");
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ T1 = M(T) = \n");
|
||||
PrintSMatrix(T1);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 FastTransposeSMatrix \n");
|
||||
@@ -94,7 +94,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ T2 = M(T) = \n");
|
||||
PrintSMatrix(T2);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 DestroySMatrix \n");
|
||||
@@ -107,7 +107,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 M 后:");
|
||||
!M.mu && !M.nu && !M.tu ? printf(" M 不存在!!\n") : printf(" M 存在!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ int main(int argc, char** argv) {
|
||||
CreateSMatrix(&M, "TestData_M.txt");
|
||||
CreateSMatrix(&N, "TestData_N.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 PrintSMatrix \n");
|
||||
@@ -21,7 +21,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ N = \n");
|
||||
PrintSMatrix(N);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 CopySMatrix \n");
|
||||
@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Tmp = \n");
|
||||
PrintSMatrix(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 AddSMatrix \n");
|
||||
@@ -46,7 +46,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q1 = M + N = \n");
|
||||
PrintSMatrix(Q1);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 SubtSMatrix \n");
|
||||
@@ -58,7 +58,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q2 = M - N = \n");
|
||||
PrintSMatrix(Q2);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 MultSMatrix \n");
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q3 = M * N = \n");
|
||||
PrintSMatrix(Q3);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 TransposeSMatrix \n");
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ T1 = M(T) = \n");
|
||||
PrintSMatrix(T1);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 FastTransposeSMatrix \n");
|
||||
@@ -94,7 +94,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ T2 = M(T) = \n");
|
||||
PrintSMatrix(T2);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 DestroySMatrix \n");
|
||||
@@ -107,7 +107,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 M 后:");
|
||||
!M.mu && !M.nu && !M.tu ? printf(" M 不存在!!\n") : printf(" M 存在!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ int main(int argc, char** argv) {
|
||||
CreateSMatrix(&M, "TestData_M.txt");
|
||||
CreateSMatrix(&N, "TestData_N.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 PrintSMatrix \n");
|
||||
@@ -21,7 +21,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ N = \n");
|
||||
PrintSMatrix(N);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 CopySMatrix \n");
|
||||
@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Tmp = \n");
|
||||
PrintSMatrix(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 AddSMatrix \n");
|
||||
@@ -46,7 +46,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q1 = M + N = \n");
|
||||
PrintSMatrix(Q1);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 SubtSMatrix \n");
|
||||
@@ -58,7 +58,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q2 = M - N = \n");
|
||||
PrintSMatrix(Q2);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 MultSMatrix \n");
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ Q3 = M * N = \n");
|
||||
PrintSMatrix(Q3);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 TransposeSMatrix \n");
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ T = M(T) = \n");
|
||||
PrintSMatrix(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ 函数 DestroySMatrix \n");
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 M 后:");
|
||||
!M.mu && !M.nu && !M.tu ? printf(" M 不存在!!\n") : printf(" M 存在!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include "GList-HT.h" //**▲05 数组和广义表**//
|
||||
|
||||
void PrintElem(AtomType e); //打印广义表原子
|
||||
// 打印广义表原子
|
||||
void PrintElem(AtomType e) {
|
||||
printf("%c ", e);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
GList Tmp, G;
|
||||
@@ -13,7 +17,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 创建空的广义表 Tmp ...\n");
|
||||
InitGList(&Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GListEmpty \n");
|
||||
{
|
||||
@@ -22,7 +26,7 @@ int main(int argc, char** argv) {
|
||||
tag = GListEmpty(Tmp);
|
||||
tag ? printf("█ Tmp 为空!\n") : printf("█ Tmp 不为空!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 CreateGList \n");
|
||||
{
|
||||
@@ -42,7 +46,7 @@ int main(int argc, char** argv) {
|
||||
StrAssign(S3, s3);
|
||||
CreateGList(&g3, S3);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 InsertFirst \n");
|
||||
{
|
||||
@@ -51,7 +55,7 @@ int main(int argc, char** argv) {
|
||||
InsertFirst(&Tmp, g2);
|
||||
InsertFirst(&Tmp, g1);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 Traverse \n");
|
||||
{
|
||||
@@ -59,14 +63,14 @@ int main(int argc, char** argv) {
|
||||
Traverse(Tmp, PrintElem);
|
||||
printf("\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 PrintGList \n");
|
||||
{
|
||||
printf("█ 带括号输出广义表 Tmp = ");
|
||||
PrintGList(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 CopyGList \n");
|
||||
{
|
||||
@@ -74,7 +78,7 @@ int main(int argc, char** argv) {
|
||||
CopyGList(&G, Tmp);
|
||||
PrintGList(G);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DeleteFirst \n");
|
||||
{
|
||||
@@ -88,19 +92,19 @@ int main(int argc, char** argv) {
|
||||
printf("█ Tmp = ");
|
||||
PrintGList(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GListLength \n");
|
||||
{
|
||||
printf("█ 广义表 G 的长度为: %d \n", GListLength(G));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GListDepth \n");
|
||||
{
|
||||
printf("█ 广义表 G 的深度为: %d\n", GListDepth(G));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GetHead \n");
|
||||
{
|
||||
@@ -110,7 +114,7 @@ int main(int argc, char** argv) {
|
||||
H = GetHead(G);
|
||||
PrintGList(H);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GetTail \n");
|
||||
{
|
||||
@@ -120,7 +124,7 @@ int main(int argc, char** argv) {
|
||||
T = GetTail(G);
|
||||
PrintGList(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DestroyGList \n");
|
||||
{
|
||||
@@ -132,11 +136,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 G 后:");
|
||||
G ? printf(" G 存在!\n") : printf(" G 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PrintElem(AtomType e) {
|
||||
printf("%c ", e);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include "GList-E.h" //**▲05 数组和广义表**//
|
||||
|
||||
void PrintElem(AtomType e); //打印广义表原子
|
||||
// 打印广义表原子
|
||||
void PrintElem(AtomType e) {
|
||||
printf("%c ", e);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
GList Tmp, G;
|
||||
@@ -13,7 +17,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 创建空的广义表 Tmp ...\n");
|
||||
InitGList(&Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GListEmpty \n");
|
||||
{
|
||||
@@ -22,7 +26,7 @@ int main(int argc, char** argv) {
|
||||
tag = GListEmpty(Tmp);
|
||||
tag ? printf("█ Tmp 为空!\n") : printf("█ Tmp 不为空!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 CreateGList \n");
|
||||
{
|
||||
@@ -42,7 +46,7 @@ int main(int argc, char** argv) {
|
||||
StrAssign(S3, s3);
|
||||
CreateGList(&g3, S3);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 InsertFirst \n");
|
||||
{
|
||||
@@ -51,7 +55,7 @@ int main(int argc, char** argv) {
|
||||
InsertFirst(&Tmp, g2);
|
||||
InsertFirst(&Tmp, g1);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 Traverse \n");
|
||||
{
|
||||
@@ -59,14 +63,14 @@ int main(int argc, char** argv) {
|
||||
Traverse(Tmp, PrintElem);
|
||||
printf("\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 PrintGList \n");
|
||||
{
|
||||
printf("█ 带括号输出广义表 Tmp = ");
|
||||
PrintGList(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 CopyGList \n");
|
||||
{
|
||||
@@ -74,7 +78,7 @@ int main(int argc, char** argv) {
|
||||
CopyGList(&G, Tmp);
|
||||
PrintGList(G);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DeleteFirst \n");
|
||||
{
|
||||
@@ -88,19 +92,19 @@ int main(int argc, char** argv) {
|
||||
printf("█ Tmp = ");
|
||||
PrintGList(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GListLength \n");
|
||||
{
|
||||
printf("█ 广义表 G 的长度为:%d\n", GListLength(G));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GListDepth_1等 \n");
|
||||
{
|
||||
printf("█ 广义表 G 的深度为:%d\n", GListDepth(G));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GetHead \n");
|
||||
{
|
||||
@@ -110,7 +114,7 @@ int main(int argc, char** argv) {
|
||||
H = GetHead(G);
|
||||
PrintGList(H);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 GetTail \n");
|
||||
{
|
||||
@@ -120,7 +124,7 @@ int main(int argc, char** argv) {
|
||||
T = GetTail(G);
|
||||
PrintGList(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 函数 DestroyGList \n");
|
||||
{
|
||||
@@ -132,11 +136,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 G 后:");
|
||||
G ? printf(" G 存在!\n") : printf(" G 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PrintElem(AtomType e) {
|
||||
printf("%c ", e);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化空二叉树 T ...\n");
|
||||
InitBiTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateBiTree \n");
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按先序序列创建二叉树 T ...\n");
|
||||
CreateBiTree(T, "TestData_Pre.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ BiTreeDepth \n");
|
||||
{
|
||||
printf("█ 二叉树 T 的深度为:%d \n", BiTreeDepth(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintTree \n");
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按二叉树的结构打印树 T ...\n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PreOrderTraverse \n");
|
||||
@@ -48,7 +48,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 前序遍历二叉树 T = ");
|
||||
PreOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InOrderTraverse \n");
|
||||
@@ -56,7 +56,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 中序遍历二叉树 T = ");
|
||||
InOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PostOrderTraverse \n");
|
||||
@@ -64,7 +64,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 后序遍历二叉树 T = ");
|
||||
PostOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LevelOrderTraverse \n");
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 层序遍历二叉树 T = ");
|
||||
LevelOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Value \n");
|
||||
@@ -80,7 +80,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'F';
|
||||
printf("█ 结点 %c 的值为 %c\n", e, Value(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Assign \n");
|
||||
@@ -91,14 +91,14 @@ int main(int argc, char* argv[]) {
|
||||
Assign(T, e, value);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Root \n");
|
||||
{
|
||||
printf("█ T 的根结点为 %c\n", Root(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Parent \n");
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的双亲为:%c \n", e, Parent(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftChild、RightChild \n");
|
||||
@@ -114,7 +114,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的左孩子结点值为:%c ,右孩子结点值为:%c\n", e, LeftChild(T, e), RightChild(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftSibling \n");
|
||||
@@ -122,7 +122,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'I';
|
||||
printf("█ 结点 %c 的左兄弟为:%c\n", e, LeftSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ RightSibling \n");
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的右兄弟为:%c\n", e, RightSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsertChild \n");
|
||||
@@ -157,7 +157,7 @@ int main(int argc, char* argv[]) {
|
||||
InsertChild(T, p2, 0, c2);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DeleteChild \n");
|
||||
@@ -173,7 +173,7 @@ int main(int argc, char* argv[]) {
|
||||
DeleteChild(T, p2, 0);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearBiTree、BiTreeEmpty \n");
|
||||
@@ -186,7 +186,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 清空后:");
|
||||
BiTreeEmpty(T) ? printf("T 为空!\n") : printf("T 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化空二叉树 T ...\n");
|
||||
InitBiTree(&T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateBiTree \n");
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按先序序列创建二叉树 T ...\n");
|
||||
CreateBiTree(&T, "TestData_Pre.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ BiTreeDepth \n");
|
||||
{
|
||||
printf("█ 二叉树 T 的深度为:%d \n", BiTreeDepth(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintTree \n");
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按二叉树的结构打印树 T ...\n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PreOrderTraverse \n");
|
||||
@@ -48,7 +48,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 前序遍历二叉树 T = ");
|
||||
PreOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InOrderTraverse \n");
|
||||
@@ -56,7 +56,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 中序遍历二叉树 T = ");
|
||||
InOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PostOrderTraverse \n");
|
||||
@@ -64,7 +64,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 后序遍历二叉树 T = ");
|
||||
PostOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LevelOrderTraverse \n");
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 层序遍历二叉树 T = ");
|
||||
LevelOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Value \n");
|
||||
@@ -80,7 +80,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'F';
|
||||
printf("█ 结点 %c 的值为 %c\n", e, Value(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Assign \n");
|
||||
@@ -91,14 +91,14 @@ int main(int argc, char* argv[]) {
|
||||
Assign(T, e, value);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Root \n");
|
||||
{
|
||||
printf("█ T 的根结点为 %c\n", Root(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Parent \n");
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的双亲为:%c \n", e, Parent(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftChild、RightChild \n");
|
||||
@@ -114,7 +114,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的左孩子结点值为:%c ,右孩子结点值为:%c\n", e, LeftChild(T, e), RightChild(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftSibling \n");
|
||||
@@ -122,7 +122,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'I';
|
||||
printf("█ 结点 %c 的左兄弟为:%c\n", e, LeftSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ RightSibling \n");
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的右兄弟为:%c\n", e, RightSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsertChild \n");
|
||||
@@ -157,7 +157,7 @@ int main(int argc, char* argv[]) {
|
||||
InsertChild(T, p2, 0, c2);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DeleteChild \n");
|
||||
@@ -173,7 +173,7 @@ int main(int argc, char* argv[]) {
|
||||
DeleteChild(T, p2, 0);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearBiTree、BiTreeEmpty \n");
|
||||
@@ -186,7 +186,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 清空后:");
|
||||
BiTreeEmpty(T) ? printf("T 为空!\n") : printf("T 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化空二叉树 T ...\n");
|
||||
InitBiTree(&T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateBiTree \n");
|
||||
@@ -24,14 +24,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按先序序列创建二叉树 T ...\n");
|
||||
CreateBiTree(&T, "TestData_Pre.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ BiTreeDepth \n");
|
||||
{
|
||||
printf("█ 二叉树 T 的深度为:%d \n", BiTreeDepth(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintTree \n");
|
||||
@@ -39,7 +39,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按二叉树的结构打印树 T ...\n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PreOrderTraverse \n");
|
||||
@@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 前序遍历二叉树 T = ");
|
||||
PreOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InOrderTraverse \n");
|
||||
@@ -55,7 +55,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 中序遍历二叉树 T = ");
|
||||
InOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PostOrderTraverse \n");
|
||||
@@ -63,7 +63,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 后序遍历二叉树 T = ");
|
||||
PostOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LevelOrderTraverse \n");
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 层序遍历二叉树 T = ");
|
||||
LevelOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Value \n");
|
||||
@@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'F';
|
||||
printf("█ 结点 %c 的值为 %c\n", e, Value(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Assign \n");
|
||||
@@ -90,14 +90,14 @@ int main(int argc, char* argv[]) {
|
||||
Assign(T, e, value);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Root \n");
|
||||
{
|
||||
printf("█ T 的根结点为 %c\n", Root(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Parent \n");
|
||||
@@ -105,7 +105,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的双亲为:%c \n", e, Parent(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftChild、RightChild \n");
|
||||
@@ -113,7 +113,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的左孩子结点值为:%c ,右孩子结点值为:%c\n", e, LeftChild(T, e), RightChild(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftSibling \n");
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'I';
|
||||
printf("█ 结点 %c 的左兄弟为:%c\n", e, LeftSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ RightSibling \n");
|
||||
@@ -129,7 +129,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的右兄弟为:%c\n", e, RightSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsertChild \n");
|
||||
@@ -156,7 +156,7 @@ int main(int argc, char* argv[]) {
|
||||
InsertChild(T, p2, 0, c2);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DeleteChild \n");
|
||||
@@ -172,7 +172,7 @@ int main(int argc, char* argv[]) {
|
||||
DeleteChild(T, p2, 0);
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearBiTree、BiTreeEmpty \n");
|
||||
@@ -185,7 +185,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 清空后:");
|
||||
BiTreeEmpty(T) ? printf("T 为空!\n") : printf("T 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 中序遍历中序全线索二叉树...\n");
|
||||
InOrderTraverse_Thr(Thr, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化空树 T ...\n");
|
||||
InitTree(&T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateTree \n");
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按先序序列创建树 T ...\n");
|
||||
CreateTree(&T, "TestData_T.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ TreeDepth \n");
|
||||
{
|
||||
printf("█ 树 T 的深度为:%d \n", TreeDepth(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintTree \n");
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PreOrderTraverse \n");
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 前序遍历树 T = ");
|
||||
PreOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PostOrderTraverse \n");
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 后序遍历树 T = ");
|
||||
PostOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LevelOrderTraverse \n");
|
||||
@@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 层序遍历树 T = ");
|
||||
LevelOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Value \n");
|
||||
@@ -73,7 +73,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'F';
|
||||
printf("█ 结点 %c 的值为 %c\n", e, Value(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Assign \n");
|
||||
@@ -85,14 +85,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Root \n");
|
||||
{
|
||||
printf("█ T 的根结点为 %c\n", Root(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Parent \n");
|
||||
@@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的双亲为:%c \n", e, Parent(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ChildCount \n");
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'X';
|
||||
printf("█ 结点 %c 有 %d 个孩子\n", e, ChildCount(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Child \n");
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char* argv[]) {
|
||||
int i = 2;
|
||||
printf("█ 结点 %c 的第 %d 个孩子结点值为:%c \n", e, i, Child(T, e, i));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftSibling \n");
|
||||
@@ -125,7 +125,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的左兄弟为:%c\n", e, LeftSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ RightSibling \n");
|
||||
@@ -133,7 +133,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的右兄弟为:%c\n", e, RightSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsertChild \n");
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DeleteChild \n");
|
||||
@@ -166,7 +166,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearTree、TreeEmpty \n");
|
||||
@@ -179,7 +179,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 清空后:");
|
||||
TreeEmpty(T) ? printf("T 为空!\n") : printf("T 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化空树 T ...\n");
|
||||
InitTree(&T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateTree \n");
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按先序序列创建树 T ...\n");
|
||||
CreateTree(&T, "TestData_T.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ TreeDepth \n");
|
||||
{
|
||||
printf("█ 树 T 的深度为:%d \n", TreeDepth(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintTree \n");
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PreOrderTraverse \n");
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 前序遍历树 T = ");
|
||||
PreOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PostOrderTraverse \n");
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 后序遍历树 T = ");
|
||||
PostOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LevelOrderTraverse \n");
|
||||
@@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 层序遍历树 T = ");
|
||||
LevelOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Value \n");
|
||||
@@ -73,7 +73,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'F';
|
||||
printf("█ 结点 %c 的值为 %c\n", e, Value(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Assign \n");
|
||||
@@ -85,14 +85,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Root \n");
|
||||
{
|
||||
printf("█ T 的根结点为 %c\n", Root(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Parent \n");
|
||||
@@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的双亲为:%c \n", e, Parent(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ChildCount \n");
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'X';
|
||||
printf("█ 结点 %c 有 %d 个孩子\n", e, ChildCount(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Child \n");
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char* argv[]) {
|
||||
int i = 2;
|
||||
printf("█ 结点 %c 的第 %d 个孩子结点值为:%c \n", e, i, Child(T, e, i));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftSibling \n");
|
||||
@@ -125,7 +125,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的左兄弟为:%c\n", e, LeftSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ RightSibling \n");
|
||||
@@ -133,7 +133,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的右兄弟为:%c\n", e, RightSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsertChild \n");
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DeleteChild \n");
|
||||
@@ -166,7 +166,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearTree、TreeEmpty \n");
|
||||
@@ -179,7 +179,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 清空后:");
|
||||
TreeEmpty(T) ? printf("T 为空!\n") : printf("T 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include "Status.h" //**▲01 绪论**//
|
||||
#include "CSTree.h" //**▲06 树和二叉树**//
|
||||
#include "CSTree.h" //**▲06 树和二叉树**//
|
||||
|
||||
// 测试函数,打印元素
|
||||
Status PrintElem(TElemType c) {
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化空树 T ...\n");
|
||||
InitTree(&T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateTree \n");
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 按先序序列创建树 T ...\n");
|
||||
CreateTree(&T, "TestData_T.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ TreeDepth \n");
|
||||
{
|
||||
printf("█ 树 T 的深度为:%d \n", TreeDepth(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintTree \n");
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PreOrderTraverse \n");
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 前序遍历树 T = ");
|
||||
PreOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PostOrderTraverse \n");
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 后序遍历树 T = ");
|
||||
PostOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LevelOrderTraverse \n");
|
||||
@@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 层序遍历树 T = ");
|
||||
LevelOrderTraverse(T, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Value \n");
|
||||
@@ -73,7 +73,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'F';
|
||||
printf("█ 结点 %c 的值为 %c\n", e, Value(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Assign \n");
|
||||
@@ -85,14 +85,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Root \n");
|
||||
{
|
||||
printf("█ T 的根结点为 %c\n", Root(T));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Parent \n");
|
||||
@@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'E';
|
||||
printf("█ 结点 %c 的双亲为:%c \n", e, Parent(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ChildCount \n");
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'X';
|
||||
printf("█ 结点 %c 有 %d 个孩子\n", e, ChildCount(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Child \n");
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char* argv[]) {
|
||||
int i = 2;
|
||||
printf("█ 结点 %c 的第 %d 个孩子结点值为:%c \n", e, i, Child(T, e, i));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LeftSibling \n");
|
||||
@@ -125,7 +125,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的左兄弟为:%c\n", e, LeftSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ RightSibling \n");
|
||||
@@ -133,7 +133,7 @@ int main(int argc, char* argv[]) {
|
||||
TElemType e = 'H';
|
||||
printf("█ 结点 %c 的右兄弟为:%c\n", e, RightSibling(T, e));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsertChild \n");
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DeleteChild \n");
|
||||
@@ -166,7 +166,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = \n");
|
||||
PrintTree(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearTree、TreeEmpty \n");
|
||||
@@ -179,7 +179,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 清空后:");
|
||||
TreeEmpty(T) ? printf("T 为空!\n") : printf("T 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化二元关系 R2 ...\n");
|
||||
initial_relation(&R2, "TestData_R2.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintSet \n");
|
||||
@@ -36,7 +36,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 输出集合 S ...\n");
|
||||
PrintSet(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
// 方案一
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 输出集合 S ...\n");
|
||||
PrintSet(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
// 方案二
|
||||
@@ -78,7 +78,7 @@ int main(int argc, char* argv[]) {
|
||||
// printf("█ 输出集合 S ...\n");
|
||||
// PrintSet(S);
|
||||
// }
|
||||
// PressEnterToContinue();
|
||||
// PressEnterToContinue(debug);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 初始化环境,主要是初始化权值信息...\n");
|
||||
InitEnvironment(&w, &n, "TestData_HT.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ HuffmanCodeing \n");
|
||||
@@ -27,7 +27,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 打印赫夫曼编码...\n");
|
||||
PrintHuffmanCode(HT, HC);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ HuffmanDecoding \n");
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 打印权值信息...\n");
|
||||
PrintWeight(HC, weight, n);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 创建集合 A ...\n");
|
||||
CreatePowerSet(&A, "TestData_A.txt");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PrintPowerSet \n");
|
||||
@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 输出集合 A = ");
|
||||
PrintPowerSet(A);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetPowerSet \n");
|
||||
@@ -32,7 +32,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 依次输出求取的幂集中的各子集...\n");
|
||||
GetPowerSet(1, A, B);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -8,21 +8,21 @@ int main(int argc, char* argv[]) {
|
||||
printf("初始化一个 %2d * %-2d 的空棋盘...\n", N, N);
|
||||
InitChessBoard();
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ ShowChessBoard \n");
|
||||
{
|
||||
printf("展示当前棋盘中的皇后布局...\n");
|
||||
ShowChessBoard();
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ Trial \n");
|
||||
{
|
||||
printf("计算 %d 皇后问题的各解...\n", N);
|
||||
Trial(1, N);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ int main(int argc, char* argv[]) {
|
||||
Output(la);
|
||||
printf("█ lb = ");
|
||||
Output(lb);
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 题 2.16 验证...\n");
|
||||
printf("█ 将la中从第2个结点起的5个结点插入到lb的第6个结点之前...\n");
|
||||
@@ -73,7 +73,7 @@ int main(int argc, char* argv[]) {
|
||||
Output(la);
|
||||
printf("█ lb = ");
|
||||
Output(lb);
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ 题 2.18 验证...\n");
|
||||
printf("█ 删除lb第6个结点起的5个结点...\n");
|
||||
|
||||
@@ -87,14 +87,14 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ S = ");
|
||||
StrPrint_4_21(S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrLength \n");
|
||||
{
|
||||
i = StrLength_4_21(S);
|
||||
printf("█ S 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCopy \n");
|
||||
{
|
||||
@@ -103,7 +103,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ T = ");
|
||||
StrPrint_4_21(T);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ StrCompare \n");
|
||||
{
|
||||
@@ -111,7 +111,7 @@ int main(int argc, char* argv[]) {
|
||||
i = StrCompare_4_21(S, T);
|
||||
i == 0 ? printf("█ S==T\n") : (i < 0 ? printf("█ S<T\n") : printf("█ S>T\n"));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
printf("████████ SubString \n");
|
||||
{
|
||||
@@ -122,7 +122,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ Sub = ");
|
||||
StrPrint_4_21(Sub);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Concat \n");
|
||||
@@ -137,7 +137,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ Tmp = ");
|
||||
StrPrint_4_21(Tmp);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 测试方法Algo_6_56:输出树的先序序列:");
|
||||
PreTraverse(Thr);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("███题 6.57 验证...███\n");
|
||||
@@ -92,7 +92,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 测试方法Algo_6_57:输出树的后序序列:");
|
||||
PosTraverse(Thr);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("███题 6.58 验证...███\n");
|
||||
@@ -134,7 +134,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("█ 插入完成后的中序全线索二叉树为:");
|
||||
InOrderTraverse_Thr(Thr, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+12
-10
@@ -2,6 +2,11 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h> // 提供宏va_list、va_start、va_arg、va_end
|
||||
#include <ctype.h> // 提供isprint原型
|
||||
#include "Status.h"
|
||||
|
||||
/* 全局变量*/
|
||||
Boolean debug = FALSE; // 是否使用debug模式。测试时可设置为TRUE,发布时可设置为FALSE(修改debug值后,一般需要重新生成静态库)。
|
||||
|
||||
|
||||
/*
|
||||
* 这是自定义的数据录入函数,用于从文件fp中读取格式化的输入
|
||||
@@ -135,20 +140,17 @@ int ReadData(FILE* fp, char* format, ...) {
|
||||
}
|
||||
|
||||
// 摁下回车键以继续运行
|
||||
void PressEnterToContinue() {
|
||||
int debug = 1;
|
||||
|
||||
void PressEnterToContinue(Boolean debug) {
|
||||
fflush(stdin);
|
||||
|
||||
printf("\nPress Enter to Continue...");
|
||||
|
||||
// 处于测试阶段时,可以让debug=1,自动添加换行,便于测试
|
||||
// 处于测试阶段时,可以让debug=TRUE,手动输入换行,以便让程序暂停下来,观察每一步的输出
|
||||
if(debug) {
|
||||
printf("\n");
|
||||
|
||||
// 发布时,可以让debug=0,手动输入换行,否则让程序暂停下来,观察每一步的输出
|
||||
} else {
|
||||
printf("\nPress Enter to Continue...");
|
||||
getchar();
|
||||
|
||||
// 发布时,可以让debug=FALSE,自动添加换行,直接出结果
|
||||
} else {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
fflush(stdin);
|
||||
|
||||
@@ -33,12 +33,14 @@ typedef int Status;
|
||||
/* 布尔类型 */
|
||||
typedef int Boolean;
|
||||
|
||||
/* 全局变量*/
|
||||
extern Boolean debug; // 是否使用debug模式
|
||||
|
||||
// 读取数据
|
||||
int ReadData(FILE* fp, char* format, ...);
|
||||
|
||||
// 摁下回车键以继续运行
|
||||
void PressEnterToContinue();
|
||||
void PressEnterToContinue(Boolean debug);
|
||||
|
||||
// 函数暂停一段时间,time不代表具体的时间
|
||||
void Wait(long time);
|
||||
|
||||
@@ -23,7 +23,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化顺序表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 不为空!\n");
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -44,7 +44,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(&L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -52,7 +52,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
@@ -60,7 +60,7 @@ int main(int argc, char** argv) {
|
||||
i = ListLength(L);
|
||||
printf("█ L 的长度为 %d \n", i);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -79,7 +79,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -87,7 +87,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, 4, &e);
|
||||
printf("█ L 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char** argv) {
|
||||
i = LocateElem(L, 7, CmpGreater);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", L.elem[i - 1]);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -142,7 +142,7 @@ int main(int argc, char** argv) {
|
||||
printf(" L 不为空!\n");
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char** argv) {
|
||||
printf(" L 不存在!!\n");
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#define UNION_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "Status.h" //**▲01 绪论**//
|
||||
#include "Status.h" //**▲01 绪论**//
|
||||
#include "SqList.h" //**▲02 线性表**//
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法2.1 ████████
|
||||
*
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "MergeSqList.h" //**▲02 线性表**//
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法2.2 ████████
|
||||
*
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "SqList.h" //**▲02 线性表**//
|
||||
|
||||
|
||||
/*
|
||||
* ████████ 算法2.2 ████████
|
||||
*
|
||||
|
||||
@@ -23,14 +23,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化单链表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(L) ? printf("█ L 为空!!\n") : printf("█ L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -48,14 +48,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ L 的长度为 %d \n", ListLength(L));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -74,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, 4, &e);
|
||||
printf("█ L 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, i, &e);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -104,7 +104,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 L 后:");
|
||||
ListEmpty(L) ? printf(" L 为空!!\n") : printf(" L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 L 后:");
|
||||
L ? printf(" L 存在!\n") : printf(" L 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateList_Head \n");
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 头插法建立单链表 L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ CreateList_Tail \n");
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 尾插法建立单链表 L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化单链表 S ...\n");
|
||||
InitList(space, &S);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(space, S) ? printf("█ S 为空!!\n") : printf("█ S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -42,7 +42,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(space, S, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -50,14 +50,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ S 中的元素为:S = ");
|
||||
ListTraverse(space, S, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ S 的长度为 %d \n", ListLength(space, S));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -76,7 +76,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:S = ");
|
||||
ListTraverse(space, S, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -84,7 +84,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(space, S, 4, &e);
|
||||
printf("█ S 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -93,7 +93,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(space, S, i, &e);
|
||||
printf("█ S 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -132,7 +132,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 S 后:");
|
||||
ListEmpty(space, S) ? printf(" S 为空!!\n") : printf(" S 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -145,7 +145,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 S 后:");
|
||||
S!=0 ? printf(" S 存在!\n") : printf(" S 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化双向循环链表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(L) ? printf("█ L 为空!!\n") : printf("█ L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -40,7 +40,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -48,14 +48,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ L 的长度为 %d \n", ListLength(L));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -74,7 +74,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ GetElem \n");
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, 4, &e);
|
||||
printf("█ L 中第 4 个位置的元素为 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
|
||||
GetElem(L, i, &e);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", e);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -104,7 +104,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", cur_e);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 清空 L 后:");
|
||||
ListEmpty(L) ? printf(" L 为空!!\n") : printf(" L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 销毁 L 后:");
|
||||
L ? printf(" L 存在!\n") : printf(" L 不存在!!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ 初始化扩展的线性链表 L ...\n");
|
||||
InitList(&L);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListEmpty \n");
|
||||
{
|
||||
ListEmpty(L) ? printf("█ L 为空!!\n") : printf("█ L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListInsert \n");
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char** argv) {
|
||||
ListInsert(&L, i, 2 * i);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListTraverse \n");
|
||||
@@ -49,14 +49,14 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListLength \n");
|
||||
{
|
||||
printf("█ L 的长度为 %d \n", ListLength(L));
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ListDelete \n");
|
||||
@@ -75,7 +75,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 删除后的元素:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ LocateElem \n");
|
||||
@@ -83,7 +83,7 @@ int main(int argc, char** argv) {
|
||||
r = LocateElem(L, 7, CmpGreater);
|
||||
printf("█ L 中第一个元素值大于 \"7\" 的元素是 \"%d\" \n", r->data);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ PriorElem \n");
|
||||
@@ -96,7 +96,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的前驱不存在!\n", r->data);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ NextElem \n");
|
||||
@@ -109,7 +109,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 元素 \"%d\" 的后继不存在!\n", r->data);
|
||||
}
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ MakeNode \n");
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ 创建结点 \"300\" ...\n");
|
||||
MakeNode(&s, 300);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsFirst \n");
|
||||
@@ -131,7 +131,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DelFirst \n");
|
||||
@@ -142,7 +142,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsBefore \n");
|
||||
@@ -154,7 +154,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ InsAfter \n");
|
||||
@@ -166,7 +166,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Append \n");
|
||||
@@ -179,7 +179,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ Remove \n");
|
||||
@@ -190,7 +190,7 @@ int main(int argc, char** argv) {
|
||||
printf("█ L 中的元素为:L = ");
|
||||
ListTraverse(L, PrintElem);
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ ClearList \n");
|
||||
@@ -203,7 +203,7 @@ int main(int argc, char** argv) {
|
||||
printf("清空 L 后:");
|
||||
ListEmpty(L) ? printf(" L 为空!!\n") : printf(" L 不为空!\n");
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
|
||||
printf("████████ DestroyList \n");
|
||||
@@ -217,7 +217,7 @@ int main(int argc, char** argv) {
|
||||
L.head != NULL && L.tail != NULL ? printf(" L 存在!\n") : printf(" L 不存在!!\n");
|
||||
|
||||
}
|
||||
PressEnterToContinue();
|
||||
PressEnterToContinue(debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user