为了账号安全,请及时绑定邮箱和手机立即绑定

模拟ATM机的错误为什么提示switch expected

模拟ATM机的错误为什么提示switch expected

C
BITEyou 2017-09-18 20:20:06
//模拟ATM机 #include<stdio.h> main() {     printf("=============================="               "  |          Please select key:                  |"               "  |          1.Quary                                    |"               "  |          2.Credit                                    |"               "  |          3.Debit                                     |"               "  |          4.Return                                   |"              "   ==============================="               );     int i,j,k;     scanf("%d",&i);     switch(i)     case 1:     printf(    "=======================" " |   your balance is$1000.     |" " |   Press any key to return...   |" " |                                                 |" "   =======================" );     case 2:     printf(     "========================="   "  |Please select Credit money:   |" "   | 1.$50                                       |"   "  | 2.$100                                       |" "   | 3.return                                     |"    " =========================  "     );     scanf("%d",&j);    switch(j)    {    case 1: printf("   your Credit money is $50,thank you !"        "Press any key to retuen...");break        case 2:        printf("   your Credit money is $100,thank you !"        "Press any key to retuen...");break        case 3:        printf("thank you for your using !"               "good bye");break    }    case 3:    printf("Please select debit money:"           "1.$50"           "2.$100"           "3.$500"           "4.$1000"           "5.return"           );           scanf("%d",&k);           switch(k)           {               case 1:               printf("your debit money is $50,thank you"                      "Press any key to return");break              case 2:                 printf("your debit money is $100,thank you"                      "Press any key to return");break               case 3:                 printf("your debit money is $500,thank you"                      "Press any key to return");break                 case 4:                   printf("your debit money is $1000,thank you"                      "Press any key to return");break               case 5:               printf("thank you for your using !"                      "good bye");break           } }
查看完整描述

3 回答

已采纳
?
暗域天堂

TA贡献27条经验 获得超13个赞

//模拟ATM机
#include<stdio.h>
main()
{
    printf(
    "  |===============================================|\n"
    "  |          Please select key:                   |\n"
    "  |          1. Quary                             |\n"
    "  |          2. Credit                            |\n"
    "  |          3. Debit                             |\n"
    "  |          4. Return                            |\n"
    "  |===============================================|\n"
    );
    int i,j,k;
    scanf("%d",&i);
    switch(i)
    {
        case 1:
            printf(
            "  |===============================================|\n"
            "  |        your balance is 1000.                  |\n"
            "  |        Press any key to return...             |\n"          
            "  |===============================================|\n"
            );
            break;
        case 2:
            printf(
            "  |===============================================|\n"
            "  |        Please select Credit money:            |\n"
            "  |          1. 50                                |\n"
            "  |          2. 100                               |\n"
            "  |          3. return                            |\n"
            "  |===============================================|\n"
            );
            scanf("%d",&j);

            switch(j)
            {
                case 1:
                    printf("   your Credit money is $50,thank you !\n"
                           "Press any key to retuen...\n");
                    break;
                case 2:
                    printf("   your Credit money is $100,thank you !\n"
                          "Press any key to retuen...\n");
                    break;
                case 3:
                   printf("thank you for your using !\n"
                          "good bye\n");
                   break;
            }
            break;
        case 3:
        printf("Please select debit money:\n"
                "       1.$50\n"
                "       2.$100\n"
                "       3.$500\n"
                "       4.$1000\n"
                "       5.return\n"
        );
        scanf("%d",&k);
        switch(k)
        {
            case 1:
                printf("your debit money is $50,thank you\n"
                      "Press any key to return\n");
                break;
            case 2:
               printf("your debit money is $100,thank you\n"
                     "Press any key to return\n");
               break;
            case 3:
               printf("your debit money is $500,thank you\n"
                     "Press any key to return\n");
               break;
            case 4:
               printf("your debit money is $1000,thank you\n"
                     "Press any key to return\n");
               break;
            case 5:
                printf("thank you for your using !\n"
                       "good bye\n");
                break;
        }
    }
}

查看完整回答
反对 回复 2017-09-19
  • onemoo
    onemoo
    如果你发帖时用格式化工具来格式化代码的话,看着会更舒服。
?
暗域天堂

TA贡献27条经验 获得超13个赞

你的代码应该写的规范一点


查看完整回答
反对 回复 2017-09-19
  • 3 回答
  • 0 关注
  • 1619 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信