From ba3d6259d10259dfff0d09a1517f59cc0babb544 Mon Sep 17 00:00:00 2001 From: iridiumR Date: Thu, 28 Oct 2021 23:02:22 +0800 Subject: [PATCH] =?UTF-8?q?6=E4=BC=BC=E4=B9=8E=E6=B2=A1=E6=9C=89bug?= =?UTF-8?q?=E7=9A=84=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ex6/ex6.cpp | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/ex6/ex6.cpp b/ex6/ex6.cpp index 5d2f322..453083a 100644 --- a/ex6/ex6.cpp +++ b/ex6/ex6.cpp @@ -94,7 +94,7 @@ Begin: int pass_num = 0; int round = 1; int finish_num = 0; - printf("发牌与完成,选择你的操作:\n"); + printf("发牌完成,选择你的操作:\n"); while (finish_num < 2 && round < 54) { @@ -112,33 +112,30 @@ Begin: } printf("剩余%d张牌\n", p1.getSize()); - if (l[0] > p1[p1.getSize() - 1]) - { - if (pass_num == 2 - finish_num) - { - pass_num = 0; - goto A; - } - printf("无法出牌,已自动跳过\n"); - pass_num++; - goto B; - } + // if (l[0] > p1[p1.getSize() - 1]) + // { + // if (pass_num == 2 - finish_num) + // { + // pass_num = 0; + // goto A; + // } + // printf("无法出牌,已自动跳过\n"); + // } A: - printf("1出牌2查看牌堆"); + printf("0出牌1查看牌堆2跳过"); scanf("%d", &opt); switch (opt) { - case 1: + case 0: printf("选择:"); scanf("%d", &opt); - if (opt >= p1.getSize()) + if (opt >= p1.getSize() || (p1[opt] < l[0]&&pass_num!=2)) { printf("错误输入\n"); goto A; } - if (p1[1]) - std::cout << "打出" << PU[l.firstInsert((p1).remove(opt))]; - if (int size = p1.getSize() == 0) + std::cout << "打出" << PU[l.firstInsert((p1).remove(opt))]; + if (p1.getSize() == 0) { s.finish(0); printf(",玩家A出完所有牌\n"); @@ -147,9 +144,10 @@ Begin: } else printf(",剩余%d张牌\n", p1.getSize()); + pass_num=0; break; - case 2: + case 1: for (int i = 0; i < l.getSize() - 1; i++) { std::cout << i << ": " << PU[l[i]]; @@ -157,6 +155,10 @@ Begin: } goto A; + case 2: + pass_num++; + goto B; + default: printf("错误输入\n"); goto A; @@ -190,6 +192,7 @@ Begin: std::cout << "打出" << PU[l.firstInsert((p2).remove(i))]; printf(",剩余%d张牌\n", p2.getSize()); + pass_num = 0; break; } } @@ -229,6 +232,7 @@ Begin: std::cout << "打出" << PU[l.firstInsert((p3).remove(i))]; printf(",剩余%d张牌\n", p3.getSize()); + pass_num = 0; break; } } @@ -250,5 +254,7 @@ Begin: printf("玩家B:%d分\n", s.score(1)); printf("玩家C:%d分\n", s.score(2)); + system("pause"); + return 0; } \ No newline at end of file