這樣試試. do {printf("請輸入1-6的數字:"); scanf("%d",&val); switch (val) { case 1: printf("1\n"); printf("2\n"); printf("3\n"); printf("4\n"); printf("5\n"); printf("6\n"); printf("7\n"); break; case 2: printf("8\n"); printf("9\n"); break; case 3: printf("10\n"); printf("11\n"); break; case 4: printf("12\n"); printf("13\n"); printf("14\n"); printf("15\n"); printf("16\n"); printf("17"); break; case 5: printf("18\n"); printf("19\n"); printf("20\n"); printf("21\n"); printf("22\n"); break; case 6: printf("23\n"); break; default: printf("24\n"); break; } printf("你想繼續嗎(Y/N)"); scanf(" %c",&ch); } while ("y" == ch || "Y" == ch);
這樣試試. do {printf("請輸入1-6的數字:"); scanf("%d",&val); switch (val) { case 1: printf("1\n"); printf("2\n"); printf("3\n"); printf("4\n"); printf("5\n"); printf("6\n"); printf("7\n"); break; case 2: printf("8\n"); printf("9\n"); break; case 3: printf("10\n"); printf("11\n"); break; case 4: printf("12\n"); printf("13\n"); printf("14\n"); printf("15\n"); printf("16\n"); printf("17"); break; case 5: printf("18\n"); printf("19\n"); printf("20\n"); printf("21\n"); printf("22\n"); break; case 6: printf("23\n"); break; default: printf("24\n"); break; } printf("你想繼續嗎(Y/N)"); scanf(" %c",&ch); } while ("y" == ch || "Y" == ch);