diff --git a/CLion/CourseBook/0201_SqList/SqList-main.c b/CLion/CourseBook/0201_SqList/SqList-main.c index e61e920..359e145 100644 --- a/CLion/CourseBook/0201_SqList/SqList-main.c +++ b/CLion/CourseBook/0201_SqList/SqList-main.c @@ -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; diff --git a/CLion/CourseBook/0202_Union/Union.h b/CLion/CourseBook/0202_Union/Union.h index 1000f6a..bcbf3d4 100644 --- a/CLion/CourseBook/0202_Union/Union.h +++ b/CLion/CourseBook/0202_Union/Union.h @@ -11,7 +11,6 @@ #include "Status.h" //**▲01 绪论**// #include "SqList.h" //**▲02 线性表**// - /* * ████████ 算法2.1 ████████ * diff --git a/CLion/CourseBook/0203_MergeSqList/MergeSqList.c b/CLion/CourseBook/0203_MergeSqList/MergeSqList.c index 62e59a7..8c05b41 100644 --- a/CLion/CourseBook/0203_MergeSqList/MergeSqList.c +++ b/CLion/CourseBook/0203_MergeSqList/MergeSqList.c @@ -6,7 +6,6 @@ #include "MergeSqList.h" //**▲02 线性表**// - /* * ████████ 算法2.2 ████████ * diff --git a/CLion/CourseBook/0203_MergeSqList/MergeSqList.h b/CLion/CourseBook/0203_MergeSqList/MergeSqList.h index 2943778..6f8869c 100644 --- a/CLion/CourseBook/0203_MergeSqList/MergeSqList.h +++ b/CLion/CourseBook/0203_MergeSqList/MergeSqList.h @@ -11,7 +11,6 @@ #include #include "SqList.h" //**▲02 线性表**// - /* * ████████ 算法2.2 ████████ * diff --git a/CLion/CourseBook/0204_LinkList/LinkList-main.c b/CLion/CourseBook/0204_LinkList/LinkList-main.c index ea2c584..cb97ff2 100644 --- a/CLion/CourseBook/0204_LinkList/LinkList-main.c +++ b/CLion/CourseBook/0204_LinkList/LinkList-main.c @@ -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; } diff --git a/CLion/CourseBook/0206_SLinkList/SLinkList-main.c b/CLion/CourseBook/0206_SLinkList/SLinkList-main.c index 5d3f74b..0579f09 100644 --- a/CLion/CourseBook/0206_SLinkList/SLinkList-main.c +++ b/CLion/CourseBook/0206_SLinkList/SLinkList-main.c @@ -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; } diff --git a/CLion/CourseBook/0208_DuLinkList/DuLinkList-main.c b/CLion/CourseBook/0208_DuLinkList/DuLinkList-main.c index 8d8ae65..5ee7fe5 100644 --- a/CLion/CourseBook/0208_DuLinkList/DuLinkList-main.c +++ b/CLion/CourseBook/0208_DuLinkList/DuLinkList-main.c @@ -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; } diff --git a/CLion/CourseBook/0209_ELinkList/ELinkList-main.c b/CLion/CourseBook/0209_ELinkList/ELinkList-main.c index a6ec568..87a84d0 100644 --- a/CLion/CourseBook/0209_ELinkList/ELinkList-main.c +++ b/CLion/CourseBook/0209_ELinkList/ELinkList-main.c @@ -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; } diff --git a/CLion/CourseBook/0211_Polynomial/Polynomial-main.c b/CLion/CourseBook/0211_Polynomial/Polynomial-main.c index ebe78e2..79e456b 100644 --- a/CLion/CourseBook/0211_Polynomial/Polynomial-main.c +++ b/CLion/CourseBook/0211_Polynomial/Polynomial-main.c @@ -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; } diff --git a/CLion/CourseBook/0301_SqStack/SqStack-main.c b/CLion/CourseBook/0301_SqStack/SqStack-main.c index 5ce58a5..e245cbb 100644 --- a/CLion/CourseBook/0301_SqStack/SqStack-main.c +++ b/CLion/CourseBook/0301_SqStack/SqStack-main.c @@ -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); -} diff --git a/CLion/CourseBook/0306_Hanoi/Hanoi.c b/CLion/CourseBook/0306_Hanoi/Hanoi.c index 0f4f83e..692b22e 100644 --- a/CLion/CourseBook/0306_Hanoi/Hanoi.c +++ b/CLion/CourseBook/0306_Hanoi/Hanoi.c @@ -6,6 +6,11 @@ #include "Hanoi.h" //**03 栈和队列**// +/* 全局变量 */ +Tower T; // 汉诺塔 +int gStep; // 统计移动步数 + + /* * ████████ 算法3.5 ████████ * diff --git a/CLion/CourseBook/0306_Hanoi/Hanoi.h b/CLion/CourseBook/0306_Hanoi/Hanoi.h index 7ebdaec..cda4519 100644 --- a/CLion/CourseBook/0306_Hanoi/Hanoi.h +++ b/CLion/CourseBook/0306_Hanoi/Hanoi.h @@ -19,12 +19,6 @@ typedef struct { int high[3]; // 三座塔的高度(持有的盘子数量) } Tower; -// 汉诺塔 -Tower T; - -// 统计移动步数 -int gStep; - /* * ████████ 算法3.5 ████████ diff --git a/CLion/CourseBook/0307_LinkQueue/LinkQueue-main.c b/CLion/CourseBook/0307_LinkQueue/LinkQueue-main.c index c1c6838..9ab2f4b 100644 --- a/CLion/CourseBook/0307_LinkQueue/LinkQueue-main.c +++ b/CLion/CourseBook/0307_LinkQueue/LinkQueue-main.c @@ -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); -} diff --git a/CLion/CourseBook/0308_SqQueue/SqQueue-main.c b/CLion/CourseBook/0308_SqQueue/SqQueue-main.c index 86cf08b..64e3b9a 100644 --- a/CLion/CourseBook/0308_SqQueue/SqQueue-main.c +++ b/CLion/CourseBook/0308_SqQueue/SqQueue-main.c @@ -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); -} diff --git a/CLion/CourseBook/0309_BankQueuing/BankQueuing.c b/CLion/CourseBook/0309_BankQueuing/BankQueuing.c index d455747..ecf3281 100644 --- a/CLion/CourseBook/0309_BankQueuing/BankQueuing.c +++ b/CLion/CourseBook/0309_BankQueuing/BankQueuing.c @@ -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); diff --git a/CLion/CourseBook/0309_BankQueuing/BankQueuing.h b/CLion/CourseBook/0309_BankQueuing/BankQueuing.h index 18c4bab..0e2c6fb 100644 --- a/CLion/CourseBook/0309_BankQueuing/BankQueuing.h +++ b/CLion/CourseBook/0309_BankQueuing/BankQueuing.h @@ -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 ████████ diff --git a/CLion/CourseBook/0401_SString/SString-main.c b/CLion/CourseBook/0401_SString/SString-main.c index f6c4199..677e570 100644 --- a/CLion/CourseBook/0401_SString/SString-main.c +++ b/CLion/CourseBook/0401_SString/SString-main.c @@ -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("█ ST\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"); -} diff --git a/CLion/CourseBook/0402_HString/HString-main.c b/CLion/CourseBook/0402_HString/HString-main.c index 56dca2f..e0626f8 100644 --- a/CLion/CourseBook/0402_HString/HString-main.c +++ b/CLion/CourseBook/0402_HString/HString-main.c @@ -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("█ ST\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"); -} diff --git a/CLion/CourseBook/0403_LString/LString-main.c b/CLion/CourseBook/0403_LString/LString-main.c index fda3807..de920b6 100644 --- a/CLion/CourseBook/0403_LString/LString-main.c +++ b/CLion/CourseBook/0403_LString/LString-main.c @@ -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("█ ST\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("█ ST\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; +} diff --git a/CLion/CourseBook/0404_KMP/KMP-main.c b/CLion/CourseBook/0404_KMP/KMP-main.c index 973e0d8..638bf37 100644 --- a/CLion/CourseBook/0404_KMP/KMP-main.c +++ b/CLion/CourseBook/0404_KMP/KMP-main.c @@ -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"); -} diff --git a/CLion/CourseBook/0501_Array/Array-main.c b/CLion/CourseBook/0501_Array/Array-main.c index ee958c6..0cc2a26 100644 --- a/CLion/CourseBook/0501_Array/Array-main.c +++ b/CLion/CourseBook/0501_Array/Array-main.c @@ -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; diff --git a/CLion/CourseBook/0502_TSMatrix/TSMatrix-main.c b/CLion/CourseBook/0502_TSMatrix/TSMatrix-main.c index 62631e4..ae136e5 100644 --- a/CLion/CourseBook/0502_TSMatrix/TSMatrix-main.c +++ b/CLion/CourseBook/0502_TSMatrix/TSMatrix-main.c @@ -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; } diff --git a/CLion/CourseBook/0503_RLSMatrix/RLSMatrix-main.c b/CLion/CourseBook/0503_RLSMatrix/RLSMatrix-main.c index 3d3167f..60557d7 100644 --- a/CLion/CourseBook/0503_RLSMatrix/RLSMatrix-main.c +++ b/CLion/CourseBook/0503_RLSMatrix/RLSMatrix-main.c @@ -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; } diff --git a/CLion/CourseBook/0504_CrossList/CrossList-main.c b/CLion/CourseBook/0504_CrossList/CrossList-main.c index 7b19bc9..2195506 100644 --- a/CLion/CourseBook/0504_CrossList/CrossList-main.c +++ b/CLion/CourseBook/0504_CrossList/CrossList-main.c @@ -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; } diff --git a/CLion/CourseBook/0505_GList-HT/GList-HT-main.c b/CLion/CourseBook/0505_GList-HT/GList-HT-main.c index afd1110..521bc76 100644 --- a/CLion/CourseBook/0505_GList-HT/GList-HT-main.c +++ b/CLion/CourseBook/0505_GList-HT/GList-HT-main.c @@ -1,7 +1,11 @@ #include #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); -} diff --git a/CLion/CourseBook/0506_GList-E/GList-E-main.c b/CLion/CourseBook/0506_GList-E/GList-E-main.c index 2250e5e..93ee27f 100644 --- a/CLion/CourseBook/0506_GList-E/GList-E-main.c +++ b/CLion/CourseBook/0506_GList-E/GList-E-main.c @@ -1,7 +1,11 @@ #include #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); -} diff --git a/CLion/CourseBook/0601_SqBiTree/SqBiTree-main.c b/CLion/CourseBook/0601_SqBiTree/SqBiTree-main.c index 9168f97..a8a3143 100644 --- a/CLion/CourseBook/0601_SqBiTree/SqBiTree-main.c +++ b/CLion/CourseBook/0601_SqBiTree/SqBiTree-main.c @@ -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; } diff --git a/CLion/CourseBook/0602_BiTree/BiTree-main.c b/CLion/CourseBook/0602_BiTree/BiTree-main.c index 677ecb4..00d0cc7 100644 --- a/CLion/CourseBook/0602_BiTree/BiTree-main.c +++ b/CLion/CourseBook/0602_BiTree/BiTree-main.c @@ -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; } diff --git a/CLion/CourseBook/0603_BiTriTree/BiTriTree-main.c b/CLion/CourseBook/0603_BiTriTree/BiTriTree-main.c index 6237155..a4decf1 100644 --- a/CLion/CourseBook/0603_BiTriTree/BiTriTree-main.c +++ b/CLion/CourseBook/0603_BiTriTree/BiTriTree-main.c @@ -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; } diff --git a/CLion/CourseBook/0604_BiThrTree/BiThrTree-main.c b/CLion/CourseBook/0604_BiThrTree/BiThrTree-main.c index cfccade..29b76d6 100644 --- a/CLion/CourseBook/0604_BiThrTree/BiThrTree-main.c +++ b/CLion/CourseBook/0604_BiThrTree/BiThrTree-main.c @@ -24,5 +24,5 @@ int main(int argc, char* argv[]) { printf("█ 中序遍历中序全线索二叉树...\n"); InOrderTraverse_Thr(Thr, PrintElem); } - PressEnterToContinue(); + PressEnterToContinue(debug); } diff --git a/CLion/CourseBook/0605_PTree/PTree-main.c b/CLion/CourseBook/0605_PTree/PTree-main.c index 7113b7f..28610f3 100644 --- a/CLion/CourseBook/0605_PTree/PTree-main.c +++ b/CLion/CourseBook/0605_PTree/PTree-main.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; } diff --git a/CLion/CourseBook/0606_CTree/CTree-main.c b/CLion/CourseBook/0606_CTree/CTree-main.c index 7ba7b3c..7b4244e 100644 --- a/CLion/CourseBook/0606_CTree/CTree-main.c +++ b/CLion/CourseBook/0606_CTree/CTree-main.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; } diff --git a/CLion/CourseBook/0607_CSTree/CSTree-main.c b/CLion/CourseBook/0607_CSTree/CSTree-main.c index 527b919..401a39e 100644 --- a/CLion/CourseBook/0607_CSTree/CSTree-main.c +++ b/CLion/CourseBook/0607_CSTree/CSTree-main.c @@ -1,6 +1,6 @@ #include #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; } diff --git a/CLion/CourseBook/0608_MFSet/MFSet-main.c b/CLion/CourseBook/0608_MFSet/MFSet-main.c index 0cf6055..16f6001 100644 --- a/CLion/CourseBook/0608_MFSet/MFSet-main.c +++ b/CLion/CourseBook/0608_MFSet/MFSet-main.c @@ -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; } diff --git a/CLion/CourseBook/0609_HuffmanTree/HuffmanTree-main.c b/CLion/CourseBook/0609_HuffmanTree/HuffmanTree-main.c index fa8e0e8..937d722 100644 --- a/CLion/CourseBook/0609_HuffmanTree/HuffmanTree-main.c +++ b/CLion/CourseBook/0609_HuffmanTree/HuffmanTree-main.c @@ -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; } \ No newline at end of file diff --git a/CLion/CourseBook/0610_PowerSet/PowerSet-main.c b/CLion/CourseBook/0610_PowerSet/PowerSet-main.c index 71b61cf..7973ce1 100644 --- a/CLion/CourseBook/0610_PowerSet/PowerSet-main.c +++ b/CLion/CourseBook/0610_PowerSet/PowerSet-main.c @@ -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; } diff --git a/CLion/CourseBook/0611_NQueens/NQueens-main.c b/CLion/CourseBook/0611_NQueens/NQueens-main.c index 9e83a8e..5fb8e16 100644 --- a/CLion/CourseBook/0611_NQueens/NQueens-main.c +++ b/CLion/CourseBook/0611_NQueens/NQueens-main.c @@ -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; } diff --git a/CLion/ExerciseBook/02.16-02.18/02.16-02.18.c b/CLion/ExerciseBook/02.16-02.18/02.16-02.18.c index d9e1826..139e964 100644 --- a/CLion/ExerciseBook/02.16-02.18/02.16-02.18.c +++ b/CLion/ExerciseBook/02.16-02.18/02.16-02.18.c @@ -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"); diff --git a/CLion/ExerciseBook/04.21/04.21.c b/CLion/ExerciseBook/04.21/04.21.c index 4dac89b..a4fe31a 100644 --- a/CLion/ExerciseBook/04.21/04.21.c +++ b/CLion/ExerciseBook/04.21/04.21.c @@ -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("█ ST\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; } diff --git a/CLion/ExerciseBook/06.56-06.58/06.56-06.58.c b/CLion/ExerciseBook/06.56-06.58/06.56-06.58.c index 189086b..9077e13 100644 --- a/CLion/ExerciseBook/06.56-06.58/06.56-06.58.c +++ b/CLion/ExerciseBook/06.56-06.58/06.56-06.58.c @@ -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); } diff --git a/CLion/Status/Status.c b/CLion/Status/Status.c index 677db90..93f3696 100644 --- a/CLion/Status/Status.c +++ b/CLion/Status/Status.c @@ -2,6 +2,11 @@ #include #include // 提供宏va_list、va_start、va_arg、va_end #include // 提供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); diff --git a/CLion/Status/Status.h b/CLion/Status/Status.h index acb6b21..ccdf43c 100644 --- a/CLion/Status/Status.h +++ b/CLion/Status/Status.h @@ -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); diff --git a/Dev-C++/CourseBook/0201_SqList/SqList-main.cpp b/Dev-C++/CourseBook/0201_SqList/SqList-main.cpp index 684e954..fefa87b 100644 --- a/Dev-C++/CourseBook/0201_SqList/SqList-main.cpp +++ b/Dev-C++/CourseBook/0201_SqList/SqList-main.cpp @@ -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 ijΪ %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; diff --git a/Dev-C++/CourseBook/0202_Union/Union.h b/Dev-C++/CourseBook/0202_Union/Union.h index c089ede..5166733 100644 --- a/Dev-C++/CourseBook/0202_Union/Union.h +++ b/Dev-C++/CourseBook/0202_Union/Union.h @@ -8,10 +8,9 @@ #define UNION_H #include -#include "Status.h" //**01 **// +#include "Status.h" //**01 **// #include "SqList.h" //**02 Ա**// - /* * 㷨2.1 * diff --git a/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.cpp b/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.cpp index 4df7d41..22d973c 100644 --- a/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.cpp +++ b/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.cpp @@ -6,7 +6,6 @@ #include "MergeSqList.h" //**02 Ա**// - /* * 㷨2.2 * diff --git a/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.h b/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.h index 12704b0..341e527 100644 --- a/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.h +++ b/Dev-C++/CourseBook/0203_MergeSqList/MergeSqList.h @@ -11,7 +11,6 @@ #include #include "SqList.h" //**02 Ա**// - /* * 㷨2.2 * diff --git a/Dev-C++/CourseBook/0204_LinkList/LinkList-main.cpp b/Dev-C++/CourseBook/0204_LinkList/LinkList-main.cpp index f9eddbb..6adf62e 100644 --- a/Dev-C++/CourseBook/0204_LinkList/LinkList-main.cpp +++ b/Dev-C++/CourseBook/0204_LinkList/LinkList-main.cpp @@ -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 ijΪ %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; } diff --git a/Dev-C++/CourseBook/0206_SLinkList/SLinkList-main.cpp b/Dev-C++/CourseBook/0206_SLinkList/SLinkList-main.cpp index c9fb486..9aea05b 100644 --- a/Dev-C++/CourseBook/0206_SLinkList/SLinkList-main.cpp +++ b/Dev-C++/CourseBook/0206_SLinkList/SLinkList-main.cpp @@ -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 ijΪ %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; } diff --git a/Dev-C++/CourseBook/0208_DuLinkList/DuLinkList-main.cpp b/Dev-C++/CourseBook/0208_DuLinkList/DuLinkList-main.cpp index 90cbb4f..ad44095 100644 --- a/Dev-C++/CourseBook/0208_DuLinkList/DuLinkList-main.cpp +++ b/Dev-C++/CourseBook/0208_DuLinkList/DuLinkList-main.cpp @@ -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 ijΪ %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; } diff --git a/Dev-C++/CourseBook/0209_ELinkList/ELinkList-main.cpp b/Dev-C++/CourseBook/0209_ELinkList/ELinkList-main.cpp index 7d37082..37eb319 100644 --- a/Dev-C++/CourseBook/0209_ELinkList/ELinkList-main.cpp +++ b/Dev-C++/CourseBook/0209_ELinkList/ELinkList-main.cpp @@ -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 ijΪ %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; } diff --git a/Dev-C++/CourseBook/0211_Polynomial/Polynomial-main.cpp b/Dev-C++/CourseBook/0211_Polynomial/Polynomial-main.cpp index a4466a3..a28bd93 100644 --- a/Dev-C++/CourseBook/0211_Polynomial/Polynomial-main.cpp +++ b/Dev-C++/CourseBook/0211_Polynomial/Polynomial-main.cpp @@ -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; } diff --git a/Dev-C++/CourseBook/0301_SqStack/SqStack-main.cpp b/Dev-C++/CourseBook/0301_SqStack/SqStack-main.cpp index ae7df91..00df95e 100644 --- a/Dev-C++/CourseBook/0301_SqStack/SqStack-main.cpp +++ b/Dev-C++/CourseBook/0301_SqStack/SqStack-main.cpp @@ -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 ijΪ %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); -} diff --git a/Dev-C++/CourseBook/0306_Hanoi/Hanoi.cpp b/Dev-C++/CourseBook/0306_Hanoi/Hanoi.cpp index c772b44..84b9b1a 100644 --- a/Dev-C++/CourseBook/0306_Hanoi/Hanoi.cpp +++ b/Dev-C++/CourseBook/0306_Hanoi/Hanoi.cpp @@ -6,6 +6,11 @@ #include "Hanoi.h" //**03 ջͶ**// +/* ȫֱ */ +Tower T; // ŵ +int gStep; // ͳƶ + + /* * 㷨3.5 * diff --git a/Dev-C++/CourseBook/0306_Hanoi/Hanoi.h b/Dev-C++/CourseBook/0306_Hanoi/Hanoi.h index 9ff9730..94d6018 100644 --- a/Dev-C++/CourseBook/0306_Hanoi/Hanoi.h +++ b/Dev-C++/CourseBook/0306_Hanoi/Hanoi.h @@ -19,12 +19,6 @@ typedef struct { int high[3]; // ĸ߶ȣе } Tower; -// ŵ -static Tower T; - -// ͳƶ -static int gStep; - /* * 㷨3.5 diff --git a/Dev-C++/CourseBook/0307_LinkQueue/LinkQueue-main.cpp b/Dev-C++/CourseBook/0307_LinkQueue/LinkQueue-main.cpp index 1e71482..f1e3db6 100644 --- a/Dev-C++/CourseBook/0307_LinkQueue/LinkQueue-main.cpp +++ b/Dev-C++/CourseBook/0307_LinkQueue/LinkQueue-main.cpp @@ -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 ijΪ %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); -} diff --git a/Dev-C++/CourseBook/0308_SqQueue/SqQueue-main.cpp b/Dev-C++/CourseBook/0308_SqQueue/SqQueue-main.cpp index 44cb59f..75f2fa6 100644 --- a/Dev-C++/CourseBook/0308_SqQueue/SqQueue-main.cpp +++ b/Dev-C++/CourseBook/0308_SqQueue/SqQueue-main.cpp @@ -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 ijΪ %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); -} diff --git a/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.cpp b/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.cpp index 836db55..795c0f9 100644 --- a/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.cpp +++ b/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.cpp @@ -9,6 +9,17 @@ #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 * @@ -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); diff --git a/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.h b/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.h index 008483c..05ebbcd 100644 --- a/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.h +++ b/Dev-C++/CourseBook/0309_BankQueuing/BankQueuing.h @@ -23,17 +23,6 @@ /* Ͷ */ typedef LinkList EventList; //¼ͣΪ -/* ȫֱǰ涼gǣ */ -static int gTotalTime; // ۼƿͻ -static int gCustomerNum; // ۼƿͻʱ - -static int gCloseTime; // ʱ,ÿӪҵ8Сʱ480 - -static EventList gEv; // ¼洢д¼ -static Event gEn; // ǰڴ¼ - -static LinkQueue gQ[N+1]; // 4ͻ,0ŵԪ - /* * 㷨3.6 diff --git a/Dev-C++/CourseBook/0401_SString/SString-main.cpp b/Dev-C++/CourseBook/0401_SString/SString-main.cpp index e51a760..6fb2133 100644 --- a/Dev-C++/CourseBook/0401_SString/SString-main.cpp +++ b/Dev-C++/CourseBook/0401_SString/SString-main.cpp @@ -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 ijΪ %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(" ST\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"); -} diff --git a/Dev-C++/CourseBook/0402_HString/HString-main.cpp b/Dev-C++/CourseBook/0402_HString/HString-main.cpp index 7e84ab0..77453b3 100644 --- a/Dev-C++/CourseBook/0402_HString/HString-main.cpp +++ b/Dev-C++/CourseBook/0402_HString/HString-main.cpp @@ -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 ijΪ %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(" ST\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"); -} diff --git a/Dev-C++/CourseBook/0403_LString/LString-main.cpp b/Dev-C++/CourseBook/0403_LString/LString-main.cpp index f9e3faa..660e474 100644 --- a/Dev-C++/CourseBook/0403_LString/LString-main.cpp +++ b/Dev-C++/CourseBook/0403_LString/LString-main.cpp @@ -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 ijΪ %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(" ST\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 ijΪ %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(" ST\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; +} diff --git a/Dev-C++/CourseBook/0404_KMP/KMP-main.cpp b/Dev-C++/CourseBook/0404_KMP/KMP-main.cpp index 451bec1..ac666f4 100644 --- a/Dev-C++/CourseBook/0404_KMP/KMP-main.cpp +++ b/Dev-C++/CourseBook/0404_KMP/KMP-main.cpp @@ -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"); -} diff --git a/Dev-C++/CourseBook/0501_Array/Array-main.cpp b/Dev-C++/CourseBook/0501_Array/Array-main.cpp index 367298f..2e50ffa 100644 --- a/Dev-C++/CourseBook/0501_Array/Array-main.cpp +++ b/Dev-C++/CourseBook/0501_Array/Array-main.cpp @@ -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; diff --git a/Dev-C++/CourseBook/0502_TSMatrix/TSMatrix-main.cpp b/Dev-C++/CourseBook/0502_TSMatrix/TSMatrix-main.cpp index 855523a..5f8b939 100644 --- a/Dev-C++/CourseBook/0502_TSMatrix/TSMatrix-main.cpp +++ b/Dev-C++/CourseBook/0502_TSMatrix/TSMatrix-main.cpp @@ -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; } diff --git a/Dev-C++/CourseBook/0503_RLSMatrix/RLSMatrix-main.cpp b/Dev-C++/CourseBook/0503_RLSMatrix/RLSMatrix-main.cpp index 190054a..75943bb 100644 --- a/Dev-C++/CourseBook/0503_RLSMatrix/RLSMatrix-main.cpp +++ b/Dev-C++/CourseBook/0503_RLSMatrix/RLSMatrix-main.cpp @@ -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; } diff --git a/Dev-C++/CourseBook/0504_CrossList/CrossList-main.cpp b/Dev-C++/CourseBook/0504_CrossList/CrossList-main.cpp index 27a899a..e80a066 100644 --- a/Dev-C++/CourseBook/0504_CrossList/CrossList-main.cpp +++ b/Dev-C++/CourseBook/0504_CrossList/CrossList-main.cpp @@ -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; } diff --git a/Dev-C++/CourseBook/0505_GList-HT/GList-HT-main.cpp b/Dev-C++/CourseBook/0505_GList-HT/GList-HT-main.cpp index b54376d..6e9a0bd 100644 --- a/Dev-C++/CourseBook/0505_GList-HT/GList-HT-main.cpp +++ b/Dev-C++/CourseBook/0505_GList-HT/GList-HT-main.cpp @@ -1,7 +1,11 @@ #include #include "GList-HT.h" //**05 ͹**// + +// ӡԭ +void PrintElem(AtomType e) { + printf("%c ", e); +} -void PrintElem(AtomType 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 ijΪ %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); -} diff --git a/Dev-C++/CourseBook/0506_GList-E/GList-E-main.cpp b/Dev-C++/CourseBook/0506_GList-E/GList-E-main.cpp index b33b5e8..9d6ac6c 100644 --- a/Dev-C++/CourseBook/0506_GList-E/GList-E-main.cpp +++ b/Dev-C++/CourseBook/0506_GList-E/GList-E-main.cpp @@ -1,7 +1,11 @@ #include #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 ijΪ%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); -} diff --git a/Dev-C++/CourseBook/0601_SqBiTree/SqBiTree-main.cpp b/Dev-C++/CourseBook/0601_SqBiTree/SqBiTree-main.cpp index 2227b81..efe0c33 100644 --- a/Dev-C++/CourseBook/0601_SqBiTree/SqBiTree-main.cpp +++ b/Dev-C++/CourseBook/0601_SqBiTree/SqBiTree-main.cpp @@ -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(" LeftChildRightChild \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(" ClearBiTreeBiTreeEmpty \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; } diff --git a/Dev-C++/CourseBook/0602_BiTree/BiTree-main.cpp b/Dev-C++/CourseBook/0602_BiTree/BiTree-main.cpp index a4365ff..3c49d2d 100644 --- a/Dev-C++/CourseBook/0602_BiTree/BiTree-main.cpp +++ b/Dev-C++/CourseBook/0602_BiTree/BiTree-main.cpp @@ -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(" LeftChildRightChild \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(" ClearBiTreeBiTreeEmpty \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; } diff --git a/Dev-C++/CourseBook/0603_BiTriTree/BiTriTree-main.cpp b/Dev-C++/CourseBook/0603_BiTriTree/BiTriTree-main.cpp index 3533f67..f3a0d93 100644 --- a/Dev-C++/CourseBook/0603_BiTriTree/BiTriTree-main.cpp +++ b/Dev-C++/CourseBook/0603_BiTriTree/BiTriTree-main.cpp @@ -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(" LeftChildRightChild \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(" ClearBiTreeBiTreeEmpty \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; } diff --git a/Dev-C++/CourseBook/0604_BiThrTree/BiThrTree-main.cpp b/Dev-C++/CourseBook/0604_BiThrTree/BiThrTree-main.cpp index 032bbd1..600f6cc 100644 --- a/Dev-C++/CourseBook/0604_BiThrTree/BiThrTree-main.cpp +++ b/Dev-C++/CourseBook/0604_BiThrTree/BiThrTree-main.cpp @@ -24,5 +24,5 @@ int main(int argc, char* argv[]) { printf(" ȫ...\n"); InOrderTraverse_Thr(Thr, PrintElem); } - PressEnterToContinue(); + PressEnterToContinue(debug); } diff --git a/Dev-C++/CourseBook/0605_PTree/PTree-main.cpp b/Dev-C++/CourseBook/0605_PTree/PTree-main.cpp index aeeefad..d077e80 100644 --- a/Dev-C++/CourseBook/0605_PTree/PTree-main.cpp +++ b/Dev-C++/CourseBook/0605_PTree/PTree-main.cpp @@ -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(" ClearTreeTreeEmpty \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; } diff --git a/Dev-C++/CourseBook/0606_CTree/CTree-main.cpp b/Dev-C++/CourseBook/0606_CTree/CTree-main.cpp index 047ad9a..1763723 100644 --- a/Dev-C++/CourseBook/0606_CTree/CTree-main.cpp +++ b/Dev-C++/CourseBook/0606_CTree/CTree-main.cpp @@ -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(" ClearTreeTreeEmpty \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; } diff --git a/Dev-C++/CourseBook/0607_CSTree/CSTree-main.cpp b/Dev-C++/CourseBook/0607_CSTree/CSTree-main.cpp index 5b3864c..be1ea85 100644 --- a/Dev-C++/CourseBook/0607_CSTree/CSTree-main.cpp +++ b/Dev-C++/CourseBook/0607_CSTree/CSTree-main.cpp @@ -1,6 +1,6 @@ #include #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(" ClearTreeTreeEmpty \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; } diff --git a/Dev-C++/CourseBook/0608_MFSet/MFSet-main.cpp b/Dev-C++/CourseBook/0608_MFSet/MFSet-main.cpp index 2a4ac2f..76d93e0 100644 --- a/Dev-C++/CourseBook/0608_MFSet/MFSet-main.cpp +++ b/Dev-C++/CourseBook/0608_MFSet/MFSet-main.cpp @@ -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; } diff --git a/Dev-C++/CourseBook/0609_HuffmanTree/HuffmanTree-main.cpp b/Dev-C++/CourseBook/0609_HuffmanTree/HuffmanTree-main.cpp index 58f8379..6768b84 100644 --- a/Dev-C++/CourseBook/0609_HuffmanTree/HuffmanTree-main.cpp +++ b/Dev-C++/CourseBook/0609_HuffmanTree/HuffmanTree-main.cpp @@ -12,7 +12,7 @@ int main(int argc, char* argv[]) { printf(" ʼҪdzʼȨֵϢ...\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; } \ No newline at end of file diff --git a/Dev-C++/CourseBook/0610_PowerSet/PowerSet-main.cpp b/Dev-C++/CourseBook/0610_PowerSet/PowerSet-main.cpp index 1f53d6a..9ccd90d 100644 --- a/Dev-C++/CourseBook/0610_PowerSet/PowerSet-main.cpp +++ b/Dev-C++/CourseBook/0610_PowerSet/PowerSet-main.cpp @@ -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; } diff --git a/Dev-C++/CourseBook/0611_NQueens/NQueens-main.cpp b/Dev-C++/CourseBook/0611_NQueens/NQueens-main.cpp index 2108189..ea655b6 100644 --- a/Dev-C++/CourseBook/0611_NQueens/NQueens-main.cpp +++ b/Dev-C++/CourseBook/0611_NQueens/NQueens-main.cpp @@ -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; } diff --git a/Dev-C++/ExerciseBook/02.16-02.18/02.16-02.18.cpp b/Dev-C++/ExerciseBook/02.16-02.18/02.16-02.18.cpp index c9bb25a..036bec6 100644 --- a/Dev-C++/ExerciseBook/02.16-02.18/02.16-02.18.cpp +++ b/Dev-C++/ExerciseBook/02.16-02.18/02.16-02.18.cpp @@ -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дӵ25뵽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(" ɾlb65...\n"); diff --git a/Dev-C++/ExerciseBook/04.21/04.21.cpp b/Dev-C++/ExerciseBook/04.21/04.21.cpp index c9a2ab7..666b967 100644 --- a/Dev-C++/ExerciseBook/04.21/04.21.cpp +++ b/Dev-C++/ExerciseBook/04.21/04.21.cpp @@ -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 ijΪ %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(" ST\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; } diff --git a/Dev-C++/ExerciseBook/06.56-06.58/06.56-06.58.cpp b/Dev-C++/ExerciseBook/06.56-06.58/06.56-06.58.cpp index 4cb0485..428528b 100644 --- a/Dev-C++/ExerciseBook/06.56-06.58/06.56-06.58.cpp +++ b/Dev-C++/ExerciseBook/06.56-06.58/06.56-06.58.cpp @@ -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); } diff --git a/Dev-C++/Status/Status.a b/Dev-C++/Status/Status.a index ca8c6eb..777e3d9 100644 Binary files a/Dev-C++/Status/Status.a and b/Dev-C++/Status/Status.a differ diff --git a/Dev-C++/Status/Status.cpp b/Dev-C++/Status/Status.cpp index 9e0c0ba..e86c209 100644 --- a/Dev-C++/Status/Status.cpp +++ b/Dev-C++/Status/Status.cpp @@ -2,6 +2,11 @@ #include #include // ṩva_listva_startva_argva_end #include // ṩ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); diff --git a/Dev-C++/Status/Status.h b/Dev-C++/Status/Status.h index 82c912f..38c4cda 100644 --- a/Dev-C++/Status/Status.h +++ b/Dev-C++/Status/Status.h @@ -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); diff --git a/VisualC++/CourseBook/0201_SqList/SqList-main.c b/VisualC++/CourseBook/0201_SqList/SqList-main.c index 340e16e..44861b7 100644 --- a/VisualC++/CourseBook/0201_SqList/SqList-main.c +++ b/VisualC++/CourseBook/0201_SqList/SqList-main.c @@ -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 ijΪ %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; diff --git a/VisualC++/CourseBook/0202_Union/Union.h b/VisualC++/CourseBook/0202_Union/Union.h index cef4815..abf36de 100644 --- a/VisualC++/CourseBook/0202_Union/Union.h +++ b/VisualC++/CourseBook/0202_Union/Union.h @@ -11,7 +11,6 @@ #include "Status.h" //**01 **// #include "SqList.h" //**02 Ա**// - /* * 㷨2.1 * diff --git a/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.c b/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.c index 4df7d41..22d973c 100644 --- a/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.c +++ b/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.c @@ -6,7 +6,6 @@ #include "MergeSqList.h" //**02 Ա**// - /* * 㷨2.2 * diff --git a/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.h b/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.h index 12704b0..341e527 100644 --- a/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.h +++ b/VisualC++/CourseBook/0203_MergeSqList/MergeSqList.h @@ -11,7 +11,6 @@ #include #include "SqList.h" //**02 Ա**// - /* * 㷨2.2 * diff --git a/VisualC++/CourseBook/0204_LinkList/LinkList-main.c b/VisualC++/CourseBook/0204_LinkList/LinkList-main.c index f9eddbb..6adf62e 100644 --- a/VisualC++/CourseBook/0204_LinkList/LinkList-main.c +++ b/VisualC++/CourseBook/0204_LinkList/LinkList-main.c @@ -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 ijΪ %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; } diff --git a/VisualC++/CourseBook/0206_SLinkList/SLinkList-main.c b/VisualC++/CourseBook/0206_SLinkList/SLinkList-main.c index c9fb486..9aea05b 100644 --- a/VisualC++/CourseBook/0206_SLinkList/SLinkList-main.c +++ b/VisualC++/CourseBook/0206_SLinkList/SLinkList-main.c @@ -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 ijΪ %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; } diff --git a/VisualC++/CourseBook/0208_DuLinkList/DuLinkList-main.c b/VisualC++/CourseBook/0208_DuLinkList/DuLinkList-main.c index 90cbb4f..ad44095 100644 --- a/VisualC++/CourseBook/0208_DuLinkList/DuLinkList-main.c +++ b/VisualC++/CourseBook/0208_DuLinkList/DuLinkList-main.c @@ -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 ijΪ %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; } diff --git a/VisualC++/CourseBook/0209_ELinkList/ELinkList-main.c b/VisualC++/CourseBook/0209_ELinkList/ELinkList-main.c index 7d37082..37eb319 100644 --- a/VisualC++/CourseBook/0209_ELinkList/ELinkList-main.c +++ b/VisualC++/CourseBook/0209_ELinkList/ELinkList-main.c @@ -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 ijΪ %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; } diff --git a/VisualC++/CourseBook/0211_Polynomial/Polynomial-main.c b/VisualC++/CourseBook/0211_Polynomial/Polynomial-main.c index dd757aa..7d8a5f7 100644 --- a/VisualC++/CourseBook/0211_Polynomial/Polynomial-main.c +++ b/VisualC++/CourseBook/0211_Polynomial/Polynomial-main.c @@ -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; } diff --git a/VisualC++/CourseBook/0301_SqStack/SqStack-main.c b/VisualC++/CourseBook/0301_SqStack/SqStack-main.c index ae7df91..00df95e 100644 --- a/VisualC++/CourseBook/0301_SqStack/SqStack-main.c +++ b/VisualC++/CourseBook/0301_SqStack/SqStack-main.c @@ -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 ijΪ %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); -} diff --git a/VisualC++/CourseBook/0306_Hanoi/Hanoi.c b/VisualC++/CourseBook/0306_Hanoi/Hanoi.c index c772b44..84b9b1a 100644 --- a/VisualC++/CourseBook/0306_Hanoi/Hanoi.c +++ b/VisualC++/CourseBook/0306_Hanoi/Hanoi.c @@ -6,6 +6,11 @@ #include "Hanoi.h" //**03 ջͶ**// +/* ȫֱ */ +Tower T; // ŵ +int gStep; // ͳƶ + + /* * 㷨3.5 * diff --git a/VisualC++/CourseBook/0306_Hanoi/Hanoi.h b/VisualC++/CourseBook/0306_Hanoi/Hanoi.h index 2f3fa97..94d6018 100644 --- a/VisualC++/CourseBook/0306_Hanoi/Hanoi.h +++ b/VisualC++/CourseBook/0306_Hanoi/Hanoi.h @@ -19,12 +19,6 @@ typedef struct { int high[3]; // ĸ߶ȣе } Tower; -// ŵ -Tower T; - -// ͳƶ -int gStep; - /* * 㷨3.5 diff --git a/VisualC++/CourseBook/0307_LinkQueue/LinkQueue-main.c b/VisualC++/CourseBook/0307_LinkQueue/LinkQueue-main.c index 1e71482..f1e3db6 100644 --- a/VisualC++/CourseBook/0307_LinkQueue/LinkQueue-main.c +++ b/VisualC++/CourseBook/0307_LinkQueue/LinkQueue-main.c @@ -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 ijΪ %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); -} diff --git a/VisualC++/CourseBook/0308_SqQueue/SqQueue-main.c b/VisualC++/CourseBook/0308_SqQueue/SqQueue-main.c index 44cb59f..75f2fa6 100644 --- a/VisualC++/CourseBook/0308_SqQueue/SqQueue-main.c +++ b/VisualC++/CourseBook/0308_SqQueue/SqQueue-main.c @@ -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 ijΪ %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); -} diff --git a/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.c b/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.c index 143402d..c86cb12 100644 --- a/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.c +++ b/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.c @@ -9,6 +9,18 @@ #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 * @@ -165,7 +177,7 @@ void CustomerArrived() { // ǰͻ̶Ŷ EnQueue(&gQ[i], customer); - printf("%3dͻ %d Ŷ...\n", customer.Count, i); + printf("%3dͻ̨ %d Ŷ...\n", customer.Count, i); Show(); /* @@ -189,7 +201,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 +320,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); diff --git a/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.h b/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.h index 8d27560..05ebbcd 100644 --- a/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.h +++ b/VisualC++/CourseBook/0309_BankQueuing/BankQueuing.h @@ -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 diff --git a/VisualC++/CourseBook/0401_SString/SString-main.c b/VisualC++/CourseBook/0401_SString/SString-main.c index e51a760..6fb2133 100644 --- a/VisualC++/CourseBook/0401_SString/SString-main.c +++ b/VisualC++/CourseBook/0401_SString/SString-main.c @@ -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 ijΪ %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(" ST\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"); -} diff --git a/VisualC++/CourseBook/0402_HString/HString-main.c b/VisualC++/CourseBook/0402_HString/HString-main.c index 7e84ab0..77453b3 100644 --- a/VisualC++/CourseBook/0402_HString/HString-main.c +++ b/VisualC++/CourseBook/0402_HString/HString-main.c @@ -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 ijΪ %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(" ST\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"); -} diff --git a/VisualC++/CourseBook/0403_LString/LString-main.c b/VisualC++/CourseBook/0403_LString/LString-main.c index f9e3faa..660e474 100644 --- a/VisualC++/CourseBook/0403_LString/LString-main.c +++ b/VisualC++/CourseBook/0403_LString/LString-main.c @@ -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 ijΪ %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(" ST\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 ijΪ %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(" ST\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; +} diff --git a/VisualC++/CourseBook/0404_KMP/KMP-main.c b/VisualC++/CourseBook/0404_KMP/KMP-main.c index 451bec1..ac666f4 100644 --- a/VisualC++/CourseBook/0404_KMP/KMP-main.c +++ b/VisualC++/CourseBook/0404_KMP/KMP-main.c @@ -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"); -} diff --git a/VisualC++/CourseBook/0501_Array/Array-main.c b/VisualC++/CourseBook/0501_Array/Array-main.c index 367298f..2e50ffa 100644 --- a/VisualC++/CourseBook/0501_Array/Array-main.c +++ b/VisualC++/CourseBook/0501_Array/Array-main.c @@ -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; diff --git a/VisualC++/CourseBook/0502_TSMatrix/TSMatrix-main.c b/VisualC++/CourseBook/0502_TSMatrix/TSMatrix-main.c index 855523a..5f8b939 100644 --- a/VisualC++/CourseBook/0502_TSMatrix/TSMatrix-main.c +++ b/VisualC++/CourseBook/0502_TSMatrix/TSMatrix-main.c @@ -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; } diff --git a/VisualC++/CourseBook/0503_RLSMatrix/RLSMatrix-main.c b/VisualC++/CourseBook/0503_RLSMatrix/RLSMatrix-main.c index 190054a..75943bb 100644 --- a/VisualC++/CourseBook/0503_RLSMatrix/RLSMatrix-main.c +++ b/VisualC++/CourseBook/0503_RLSMatrix/RLSMatrix-main.c @@ -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; } diff --git a/VisualC++/CourseBook/0504_CrossList/CrossList-main.c b/VisualC++/CourseBook/0504_CrossList/CrossList-main.c index 27a899a..e80a066 100644 --- a/VisualC++/CourseBook/0504_CrossList/CrossList-main.c +++ b/VisualC++/CourseBook/0504_CrossList/CrossList-main.c @@ -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; } diff --git a/VisualC++/CourseBook/0505_GList-HT/GList-HT-main.c b/VisualC++/CourseBook/0505_GList-HT/GList-HT-main.c index e92b72c..4539252 100644 --- a/VisualC++/CourseBook/0505_GList-HT/GList-HT-main.c +++ b/VisualC++/CourseBook/0505_GList-HT/GList-HT-main.c @@ -1,7 +1,11 @@ #include #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 ijΪ %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); -} diff --git a/VisualC++/CourseBook/0506_GList-E/GList-E-main.c b/VisualC++/CourseBook/0506_GList-E/GList-E-main.c index b33b5e8..9d6ac6c 100644 --- a/VisualC++/CourseBook/0506_GList-E/GList-E-main.c +++ b/VisualC++/CourseBook/0506_GList-E/GList-E-main.c @@ -1,7 +1,11 @@ #include #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 ijΪ%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); -} diff --git a/VisualC++/CourseBook/0601_SqBiTree/SqBiTree-main.c b/VisualC++/CourseBook/0601_SqBiTree/SqBiTree-main.c index 2227b81..efe0c33 100644 --- a/VisualC++/CourseBook/0601_SqBiTree/SqBiTree-main.c +++ b/VisualC++/CourseBook/0601_SqBiTree/SqBiTree-main.c @@ -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(" LeftChildRightChild \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(" ClearBiTreeBiTreeEmpty \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; } diff --git a/VisualC++/CourseBook/0602_BiTree/BiTree-main.c b/VisualC++/CourseBook/0602_BiTree/BiTree-main.c index a4365ff..3c49d2d 100644 --- a/VisualC++/CourseBook/0602_BiTree/BiTree-main.c +++ b/VisualC++/CourseBook/0602_BiTree/BiTree-main.c @@ -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(" LeftChildRightChild \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(" ClearBiTreeBiTreeEmpty \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; } diff --git a/VisualC++/CourseBook/0603_BiTriTree/BiTriTree-main.c b/VisualC++/CourseBook/0603_BiTriTree/BiTriTree-main.c index 3533f67..f3a0d93 100644 --- a/VisualC++/CourseBook/0603_BiTriTree/BiTriTree-main.c +++ b/VisualC++/CourseBook/0603_BiTriTree/BiTriTree-main.c @@ -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(" LeftChildRightChild \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(" ClearBiTreeBiTreeEmpty \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; } diff --git a/VisualC++/CourseBook/0604_BiThrTree/BiThrTree-main.c b/VisualC++/CourseBook/0604_BiThrTree/BiThrTree-main.c index 032bbd1..600f6cc 100644 --- a/VisualC++/CourseBook/0604_BiThrTree/BiThrTree-main.c +++ b/VisualC++/CourseBook/0604_BiThrTree/BiThrTree-main.c @@ -24,5 +24,5 @@ int main(int argc, char* argv[]) { printf(" ȫ...\n"); InOrderTraverse_Thr(Thr, PrintElem); } - PressEnterToContinue(); + PressEnterToContinue(debug); } diff --git a/VisualC++/CourseBook/0605_PTree/PTree-main.c b/VisualC++/CourseBook/0605_PTree/PTree-main.c index aeeefad..d077e80 100644 --- a/VisualC++/CourseBook/0605_PTree/PTree-main.c +++ b/VisualC++/CourseBook/0605_PTree/PTree-main.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(" ClearTreeTreeEmpty \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; } diff --git a/VisualC++/CourseBook/0606_CTree/CTree-main.c b/VisualC++/CourseBook/0606_CTree/CTree-main.c index 047ad9a..1763723 100644 --- a/VisualC++/CourseBook/0606_CTree/CTree-main.c +++ b/VisualC++/CourseBook/0606_CTree/CTree-main.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(" ClearTreeTreeEmpty \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; } diff --git a/VisualC++/CourseBook/0607_CSTree/CSTree-main.c b/VisualC++/CourseBook/0607_CSTree/CSTree-main.c index 5b3864c..65ebb4c 100644 --- a/VisualC++/CourseBook/0607_CSTree/CSTree-main.c +++ b/VisualC++/CourseBook/0607_CSTree/CSTree-main.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(" ClearTreeTreeEmpty \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; } diff --git a/VisualC++/CourseBook/0608_MFSet/MFSet-main.c b/VisualC++/CourseBook/0608_MFSet/MFSet-main.c index 2a4ac2f..76d93e0 100644 --- a/VisualC++/CourseBook/0608_MFSet/MFSet-main.c +++ b/VisualC++/CourseBook/0608_MFSet/MFSet-main.c @@ -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; } diff --git a/VisualC++/CourseBook/0609_HuffmanTree/HuffmanTree-main.c b/VisualC++/CourseBook/0609_HuffmanTree/HuffmanTree-main.c index 58f8379..6768b84 100644 --- a/VisualC++/CourseBook/0609_HuffmanTree/HuffmanTree-main.c +++ b/VisualC++/CourseBook/0609_HuffmanTree/HuffmanTree-main.c @@ -12,7 +12,7 @@ int main(int argc, char* argv[]) { printf(" ʼҪdzʼȨֵϢ...\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; } \ No newline at end of file diff --git a/VisualC++/CourseBook/0610_PowerSet/PowerSet-main.c b/VisualC++/CourseBook/0610_PowerSet/PowerSet-main.c index 1f53d6a..9ccd90d 100644 --- a/VisualC++/CourseBook/0610_PowerSet/PowerSet-main.c +++ b/VisualC++/CourseBook/0610_PowerSet/PowerSet-main.c @@ -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; } diff --git a/VisualC++/CourseBook/0611_NQueens/NQueens-main.c b/VisualC++/CourseBook/0611_NQueens/NQueens-main.c index 2108189..ea655b6 100644 --- a/VisualC++/CourseBook/0611_NQueens/NQueens-main.c +++ b/VisualC++/CourseBook/0611_NQueens/NQueens-main.c @@ -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; } diff --git a/VisualC++/CourseBook/CourseBook.sdf b/VisualC++/CourseBook/CourseBook.sdf index b017383..82700e8 100644 Binary files a/VisualC++/CourseBook/CourseBook.sdf and b/VisualC++/CourseBook/CourseBook.sdf differ diff --git a/VisualC++/CourseBook/CourseBook.suo b/VisualC++/CourseBook/CourseBook.suo index 2e37853..baaeb6b 100644 Binary files a/VisualC++/CourseBook/CourseBook.suo and b/VisualC++/CourseBook/CourseBook.suo differ diff --git a/VisualC++/ExerciseBook/02.16-02.18/02.16-02.18.c b/VisualC++/ExerciseBook/02.16-02.18/02.16-02.18.c index c9bb25a..036bec6 100644 --- a/VisualC++/ExerciseBook/02.16-02.18/02.16-02.18.c +++ b/VisualC++/ExerciseBook/02.16-02.18/02.16-02.18.c @@ -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дӵ25뵽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(" ɾlb65...\n"); diff --git a/VisualC++/ExerciseBook/04.21/04.21.c b/VisualC++/ExerciseBook/04.21/04.21.c index c9a2ab7..666b967 100644 --- a/VisualC++/ExerciseBook/04.21/04.21.c +++ b/VisualC++/ExerciseBook/04.21/04.21.c @@ -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 ijΪ %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(" ST\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; } diff --git a/VisualC++/ExerciseBook/06.56-06.58/06.56-06.58.c b/VisualC++/ExerciseBook/06.56-06.58/06.56-06.58.c index 4cb0485..428528b 100644 --- a/VisualC++/ExerciseBook/06.56-06.58/06.56-06.58.c +++ b/VisualC++/ExerciseBook/06.56-06.58/06.56-06.58.c @@ -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); } diff --git a/VisualC++/ExerciseBook/ExerciseBook.sdf b/VisualC++/ExerciseBook/ExerciseBook.sdf index 219c0de..b416fe9 100644 Binary files a/VisualC++/ExerciseBook/ExerciseBook.sdf and b/VisualC++/ExerciseBook/ExerciseBook.sdf differ diff --git a/VisualC++/ExerciseBook/ExerciseBook.suo b/VisualC++/ExerciseBook/ExerciseBook.suo index 8f1085f..5247804 100644 Binary files a/VisualC++/ExerciseBook/ExerciseBook.suo and b/VisualC++/ExerciseBook/ExerciseBook.suo differ diff --git a/VisualC++/Status/Status.c b/VisualC++/Status/Status.c index 4d182b3..7a1a1cf 100644 --- a/VisualC++/Status/Status.c +++ b/VisualC++/Status/Status.c @@ -2,6 +2,11 @@ #include #include // ṩva_listva_startva_argva_end #include // ṩ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); diff --git a/VisualC++/Status/Status.h b/VisualC++/Status/Status.h index d578daf..33d5abf 100644 --- a/VisualC++/Status/Status.h +++ b/VisualC++/Status/Status.h @@ -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); diff --git a/VisualC++/Status/Status.lib b/VisualC++/Status/Status.lib index 0669bee..27e2d8e 100644 Binary files a/VisualC++/Status/Status.lib and b/VisualC++/Status/Status.lib differ diff --git a/VisualC++/Status/Status.sdf b/VisualC++/Status/Status.sdf index 3116cfc..6d2b985 100644 Binary files a/VisualC++/Status/Status.sdf and b/VisualC++/Status/Status.sdf differ diff --git a/VisualC++/Status/Status.suo b/VisualC++/Status/Status.suo index a090b7a..c1bb4f5 100644 Binary files a/VisualC++/Status/Status.suo and b/VisualC++/Status/Status.suo differ