diff --git a/ex1/ex1.cpp b/ex1/ex1.cpp index 4c880d7..1c16429 100644 --- a/ex1/ex1.cpp +++ b/ex1/ex1.cpp @@ -4,15 +4,15 @@ #include int LENGTH; -//数组长度 +//鏁扮粍闀垮害 int RANDOM = 0; -//是否随机生成数组 +//鏄惁闅忔満鐢熸垚鏁扮粍 int MODE = 0; -//1: 迭代 -//2: 递归 +//1: 杩唬 +//2: 閫掑綊 // #define OUTPUT -//是否输出 +//鏄惁杈撳嚭 int *a; @@ -87,18 +87,18 @@ void init() int main() { Begin: - printf("是否随机生成数组(0/1):"); + printf("鏄惁闅忔満鐢熸垚鏁扮粍(0/1):"); scanf("%d", &RANDOM); - printf("输入数组长度:"); + printf("杈撳叆鏁扮粍闀垮害:"); scanf("%d", &LENGTH); - printf("选择模式:1.迭代 2.递归"); + printf("閫夋嫨妯″紡:1.杩唬 2.閫掑綊"); scanf("%d", &MODE); if ((MODE <= 0) || (MODE >= 3)) { - printf("错误输入\n"); + printf("閿欒杈撳叆\n"); goto Begin; } @@ -122,7 +122,7 @@ Begin: printf("%d \n", a[i]); #endif - printf("运算时间: %.4f 秒\n", ((double)(end_t - start_t) / CLOCKS_PER_SEC)); + printf("杩愮畻鏃堕棿: %.4f 绉抃n", ((double)(end_t - start_t) / CLOCKS_PER_SEC)); system("pause"); goto Begin; diff --git a/ex2/ex2.cpp b/ex2/ex2.cpp index bebaa87..8ec32ec 100644 --- a/ex2/ex2.cpp +++ b/ex2/ex2.cpp @@ -162,40 +162,40 @@ int main() int temp[10] = {0}; int flag; - printf("初始化,输出数组\n"); + printf("鍒濆鍖栵紝杈撳嚭鏁扮粍\n"); v.printall(); while (1) { - printf("选择操作:1.插入 2.删除 3.查找\n"); + printf("閫夋嫨鎿嶄綔:1.鎻掑叆 2.鍒犻櫎 3.鏌ユ壘\n"); scanf("%d", &flag); switch (flag) { case 1: - printf("输入秩与待插入数值\n"); + printf("杈撳叆绉╀笌寰呮彃鍏ユ暟鍊糪n"); scanf("%d %d", &temp[0], &temp[1]); - (v.insert(temp[0], temp[1])) ? (printf("非法输入\n")) : (printf("输出数组\n")); + (v.insert(temp[0], temp[1])) ? (printf("闈炴硶杈撳叆\n")) : (printf("杈撳嚭鏁扮粍\n")); v.printall(); break; case 2: - printf("输入秩与待删除个数\n"); + printf("杈撳叆绉╀笌寰呭垹闄や釜鏁癨n"); scanf("%d %d", &temp[0], &temp[1]); - (v.del(temp[0], temp[1])) ? (printf("非法输入\n")) : (printf("输出数组\n")); + (v.del(temp[0], temp[1])) ? (printf("闈炴硶杈撳叆\n")) : (printf("杈撳嚭鏁扮粍\n")); v.printall(); break; case 3: - printf("输入要查找的数值\n"); + printf("杈撳叆瑕佹煡鎵剧殑鏁板糪n"); scanf("%d", &temp[0]); temp[2] = v.find(temp[0]); - (temp[2] == -1) ? (printf("无此元素\n")) : (printf("秩为%d \n", temp[2])); + (temp[2] == -1) ? (printf("鏃犳鍏冪礌\n")) : (printf("绉╀负%d \n", temp[2])); break; default: - printf("返回菜单\n"); + printf("杩斿洖鑿滃崟\n"); } flag = 0; diff --git a/ex3/ex3.cpp b/ex3/ex3.cpp index 4b6f4bf..b5a7e80 100644 --- a/ex3/ex3.cpp +++ b/ex3/ex3.cpp @@ -1,6 +1,6 @@ #include #include -#include "vec.cpp" +#include "vec.h" int main() { int flag = 0; @@ -8,50 +8,50 @@ int main() srand(time(NULL)); int len; - printf("输入生成数量\n"); + printf("杈撳叆鐢熸垚鏁伴噺\n"); scanf("%d", &len); Vec v(len); v.printall(); system("pause"); - printf("排序:秩为%d\n",v.getused()); + printf("鎺掑簭:绉╀负%d\n",v.getused()); // v.bubbleSort(); v.mergeSort(0,v.getused()); v.printall(); while (1) { - printf("选择操作:1.插入 2.删除 3.统计 4.退出\n"); + printf("閫夋嫨鎿嶄綔:1.鎻掑叆 2.鍒犻櫎 3.缁熻 4.閫鍑篭n"); scanf("%d", &flag); switch (flag) { case 1: - printf("输入待插入数值\n"); + printf("杈撳叆寰呮彃鍏ユ暟鍊糪n"); scanf("%d", &temp[0]); - printf("插入秩为%d处\n",v.search(temp[0]) + 1); - (v.insert(v.search(temp[0]) + 1, temp[0]) != -1) ? (printf("输出数组\n")) : (printf("无此元素或超出范围\n")); + printf("鎻掑叆绉╀负%d澶刓n",v.search(temp[0]) + 1); + (v.insert(v.search(temp[0]) + 1, temp[0]) != -1) ? (printf("杈撳嚭鏁扮粍\n")) : (printf("鏃犳鍏冪礌鎴栬秴鍑鸿寖鍥碶n")); v.printall(); break; case 2: - printf("输入待删除元素\n"); + printf("杈撳叆寰呭垹闄ゅ厓绱燶n"); scanf("%d", &temp[0]); - (v.remove_sorted(temp[0]) != -1) ? (printf("输出数组\n")) : (printf("无此元素或超出范围\n")); + (v.remove_sorted(temp[0]) != -1) ? (printf("杈撳嚭鏁扮粍\n")) : (printf("鏃犳鍏冪礌鎴栬秴鍑鸿寖鍥碶n")); v.printall(); break; case 3: - printf("输入统计的数值\n"); + printf("杈撳叆缁熻鐨勬暟鍊糪n"); scanf("%d", &temp[0]); temp[1] = v.count(temp[0]); - (temp[1] != -1) ? (printf("一共%d个\n", temp[1])) : (printf("无此元素或超出范围\n")); + (temp[1] != -1) ? (printf("涓鍏%d涓猏n", temp[1])) : (printf("鏃犳鍏冪礌鎴栬秴鍑鸿寖鍥碶n")); break; case 4: return 0; default: - printf("返回菜单\n"); + printf("杩斿洖鑿滃崟\n"); } flag = 0; } diff --git a/ex3/vec.cpp b/ex3/vec.cpp index 930a091..85159d1 100644 --- a/ex3/vec.cpp +++ b/ex3/vec.cpp @@ -59,7 +59,7 @@ void Vec::shrink() delete[] _v; _v = p; } -//位置 数值 +//浣嶇疆 鏁板 int Vec::insert(int locate, int value) { if (locate == _used + 1) @@ -84,7 +84,7 @@ int Vec::insert(int locate, int value) return 0; } -//位置 删除个数 +//浣嶇疆 鍒犻櫎涓暟 int Vec::remove(int locate, int value) { @@ -101,7 +101,7 @@ int Vec::remove(int locate, int value) return value; } -//删除某一元素 +//鍒犻櫎鏌愪竴鍏冪礌 int Vec::remove_sorted(int value) { int j, i; diff --git a/ex4/ex4.cpp b/ex4/ex4.cpp index 54bfedb..cf808c6 100644 --- a/ex4/ex4.cpp +++ b/ex4/ex4.cpp @@ -1,6 +1,6 @@ #include #include -#include "vec.cpp" +#include "vec.h" int main() { int flag = 0; diff --git a/ex5/ex5.cpp b/ex5/ex5.cpp index d343b90..80d4d41 100644 --- a/ex5/ex5.cpp +++ b/ex5/ex5.cpp @@ -1,5 +1,5 @@ -#include "vec.cpp" -#include "list.cpp" +#include "vec.h" +#include "list.h" #include #include std::string PU[54] = { @@ -22,14 +22,14 @@ int main() { int xipai_flag = 0; - printf("生成随机扑克序列\n"); + printf("鐢熸垚闅忔満鎵戝厠搴忓垪\n"); srand(time(NULL)); Vec v(54, 2); // v.printall(); List l; - printf("开始建立链表\n"); + printf("寮濮嬪缓绔嬮摼琛╘n"); for (int i = 0; i <= 53; i++) { @@ -40,7 +40,7 @@ int main() } Begin: - printf("\n是否重新洗牌?(0/1)"); + printf("\n鏄惁閲嶆柊娲楃墝?(0/1)"); scanf("%d", &xipai_flag); if (xipai_flag == 1) @@ -49,7 +49,7 @@ Begin: l.clear(); - printf("开始建立链表\n"); + printf("寮濮嬪缓绔嬮摼琛╘n"); for (int i = 0; i <= 53; i++) { @@ -61,7 +61,7 @@ Begin: xipai_flag == 0; goto Begin; } - printf("开始发牌\n"); + printf("寮濮嬪彂鐗孿n"); List p1, p2, p3; for (int i = 0; i <= 53; i++) { @@ -85,7 +85,7 @@ Begin: int player = 0, opt = 0; List *pai; select: - printf("选择玩家(1/2/3)"); + printf("閫夋嫨鐜╁(1/2/3)"); scanf("%d", &player); switch (player) { @@ -99,13 +99,13 @@ select: pai = &p3; break; default: - printf("失败\n"); + printf("澶辫触\n"); goto select; } while (1) { - printf("1看牌2出牌3查看牌堆4结束"); + printf("1鐪嬬墝2鍑虹墝3鏌ョ湅鐗屽爢4缁撴潫"); scanf("%d", &opt); switch (opt) { @@ -114,16 +114,16 @@ select: { std::cout << i << ": " << PU[(*pai)[i]] << "\n"; } - printf("剩余%d张牌\n", pai->getSize()); + printf("鍓╀綑%d寮犵墝\n", pai->getSize()); break; case 2: - printf("选择:"); + printf("閫夋嫨:"); scanf("%d", &opt); // l.firstInsert((*pai)[opt]); - std::cout << "打出" << PU[l.firstInsert((*pai).remove(opt))]; + std::cout << "鎵撳嚭" << PU[l.firstInsert((*pai).remove(opt))]; printf("\n"); - printf("剩余%d张牌\n", pai->getSize()); + printf("鍓╀綑%d寮犵墝\n", pai->getSize()); break; case 3: @@ -138,7 +138,7 @@ select: goto select; default: - printf("失败\n"); + printf("澶辫触\n"); } } return 0; diff --git a/ex5/vec.cpp b/ex5/vec.cpp index 1826962..91240e4 100644 --- a/ex5/vec.cpp +++ b/ex5/vec.cpp @@ -68,7 +68,7 @@ void Vec::shrink() delete[] _v; _v = p; } -//位置 数值 +//浣嶇疆 鏁板 int Vec::insert(int locate, int value) { if (locate == _used + 1) @@ -93,7 +93,7 @@ int Vec::insert(int locate, int value) return 0; } -//位置 删除个数 +//浣嶇疆 鍒犻櫎涓暟 int Vec::remove(int locate, int value) { @@ -110,7 +110,7 @@ int Vec::remove(int locate, int value) return value; } -//删除某一元素 +//鍒犻櫎鏌愪竴鍏冪礌 int Vec::remove_sorted(int value) { int j, i; diff --git a/ex6/ex6.cpp b/ex6/ex6.cpp index e9faa8d..d627d64 100644 --- a/ex6/ex6.cpp +++ b/ex6/ex6.cpp @@ -25,13 +25,13 @@ int main() { Score s(3); int xipai_flag = 0; - printf("生成随机扑克序列\n"); + printf("鐢熸垚闅忔満鎵戝厠搴忓垪\n"); srand(time(NULL)); Vec v(54, 2); List l; - printf("开始建立链表\n"); + printf("寮濮嬪缓绔嬮摼琛╘n"); for (int i = 0; i <= 53; i++) { @@ -42,7 +42,7 @@ int main() } Begin: - printf("\n是否重新洗牌?(0/1)"); + printf("\n鏄惁閲嶆柊娲楃墝?(0/1)"); scanf("%d", &xipai_flag); if (xipai_flag == 1) @@ -51,7 +51,7 @@ Begin: l.clear(); - printf("===============开始建立链表===============\n"); + printf("===============寮濮嬪缓绔嬮摼琛===============\n"); for (int i = 0; i <= 53; i++) { @@ -63,7 +63,7 @@ Begin: xipai_flag == 0; goto Begin; } - printf("================开始发牌================\n"); + printf("================寮濮嬪彂鐗================\n"); List p1, p2, p3; for (int i = 0; i <= 53; i++) { @@ -80,7 +80,7 @@ Begin: break; } } - printf("你手中的牌:\n"); + printf("浣犳墜涓殑鐗:\n"); for (int i = 0; i < p1.getSize(); i++) { std::cout << i << ": " << PU[(p1)[i]] << "\n"; @@ -94,23 +94,23 @@ Begin: int pass_num = 0; int round = 1; int finish_num = 0; - printf("理牌完成,选择你的操作:\n"); + printf("鐞嗙墝瀹屾垚,閫夋嫨浣犵殑鎿嶄綔:\n"); while (finish_num < 2 && round < 54) { if (pass_num > 3 - finish_num) pass_num = 3 - finish_num; - printf("+++++===========================+++++\n 轮次%d \n+++++===========================+++++\n", round); + printf("+++++===========================+++++\n 杞%d \n+++++===========================+++++\n", round); if (p1.getSize()) { - printf("你手中的牌:\n"); + printf("浣犳墜涓殑鐗:\n"); for (int i = 0; i < p1.getSize(); i++) { std::cout << i << ": " << PU[(p1)[i]] << "\n"; } - printf("剩余%d张牌\n", p1.getSize()); + printf("鍓╀綑%d寮犵墝\n", p1.getSize()); // if (l[0] > p1[p1.getSize() - 1]) // { @@ -119,31 +119,31 @@ Begin: // pass_num = 0; // goto A; // } - // printf("无法出牌,已自动跳过\n"); + // printf("鏃犳硶鍑虹墝锛屽凡鑷姩璺宠繃\n"); // } A: - printf("0出牌1查看牌堆2跳过"); + printf("0鍑虹墝1鏌ョ湅鐗屽爢2璺宠繃"); scanf("%d", &opt); switch (opt) { case 0: - printf("选择:"); + printf("閫夋嫨:"); scanf("%d", &opt); if (opt >= p1.getSize() || (p1[opt] < l[0]&&pass_num!=2)) { - printf("错误输入\n"); + printf("閿欒杈撳叆\n"); goto A; } - std::cout << "打出" << PU[l.firstInsert((p1).remove(opt))]; + std::cout << "鎵撳嚭" << PU[l.firstInsert((p1).remove(opt))]; if (p1.getSize() == 0) { s.finish(0); - printf(",玩家A出完所有牌\n"); + printf(",鐜╁A鍑哄畬鎵鏈夌墝\n"); finish_num++; pass_num = 0; } else - printf(",剩余%d张牌\n", p1.getSize()); + printf(",鍓╀綑%d寮犵墝\n", p1.getSize()); pass_num=0; break; @@ -160,27 +160,27 @@ Begin: goto B; default: - printf("错误输入\n"); + printf("閿欒杈撳叆\n"); goto A; } } else - printf("玩家A轮空\n"); + printf("鐜╁A杞┖\n"); B: if (p2.getSize()) { printf("--------------------\n"); - printf("B玩家"); + printf("B鐜╁"); if (pass_num == 2 - finish_num) { - std::cout << "打出" << PU[l.firstInsert((p2).remove(0))]; - printf(",剩余%d张牌\n", p2.getSize()); + std::cout << "鎵撳嚭" << PU[l.firstInsert((p2).remove(0))]; + printf(",鍓╀綑%d寮犵墝\n", p2.getSize()); pass_num = 0; } else if (l[0] > p2[p2.getSize() - 1]) { - printf("无牌可出,跳过\n"); + printf("鏃犵墝鍙嚭锛岃烦杩嘰n"); pass_num++; } else @@ -189,9 +189,9 @@ Begin: if (l[0] < p2[i]) { - std::cout << "打出" << PU[l.firstInsert((p2).remove(i))]; + std::cout << "鎵撳嚭" << PU[l.firstInsert((p2).remove(i))]; - printf(",剩余%d张牌\n", p2.getSize()); + printf(",鍓╀綑%d寮犵墝\n", p2.getSize()); pass_num = 0; break; } @@ -199,28 +199,28 @@ Begin: if (p2.getSize() == 0) { s.finish(1); - printf("玩家B出完所有牌\n"); + printf("鐜╁B鍑哄畬鎵鏈夌墝\n"); finish_num++; pass_num = 0; } } else - printf("玩家B轮空\n"); + printf("鐜╁B杞┖\n"); C: if (p3.getSize()) { printf("--------------------\n"); - printf("C玩家"); + printf("C鐜╁"); if (pass_num == 2 - finish_num) { - std::cout << "打出" << PU[l.firstInsert((p3).remove(0))]; - printf(",剩余%d张牌\n", p3.getSize()); + std::cout << "鎵撳嚭" << PU[l.firstInsert((p3).remove(0))]; + printf(",鍓╀綑%d寮犵墝\n", p3.getSize()); pass_num = 0; } else if (l[0] > p3[p3.getSize() - 1]) { - printf("无牌可出,跳过\n"); + printf("鏃犵墝鍙嚭锛岃烦杩嘰n"); pass_num++; } else @@ -229,9 +229,9 @@ Begin: if (l[0] < p3[i]) { - std::cout << "打出" << PU[l.firstInsert((p3).remove(i))]; + std::cout << "鎵撳嚭" << PU[l.firstInsert((p3).remove(i))]; - printf(",剩余%d张牌\n", p3.getSize()); + printf(",鍓╀綑%d寮犵墝\n", p3.getSize()); pass_num = 0; break; } @@ -239,20 +239,20 @@ Begin: if (p3.getSize() == 0) { s.finish(2); - printf("玩家C出完所有牌\n"); + printf("鐜╁C鍑哄畬鎵鏈夌墝\n"); finish_num++; pass_num = 0; } } else - printf("玩家C轮空\n"); + printf("鐜╁C杞┖\n"); round++; } printf("=====================================\n"); - printf("分数结算:\n"); - printf("玩家A:%d分\n", s.score(0)); - printf("玩家B:%d分\n", s.score(1)); - printf("玩家C:%d分\n", s.score(2)); + printf("鍒嗘暟缁撶畻:\n"); + printf("鐜╁A:%d鍒哱n", s.score(0)); + printf("鐜╁B:%d鍒哱n", s.score(1)); + printf("鐜╁C:%d鍒哱n", s.score(2)); system("pause");