| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 562 人关注过本帖
标题:关于模拟ATM机模拟程序
只看楼主 加入收藏
lyd910915
Rank: 2
等 级:论坛游民
帖 子:7
专家分:18
注 册:2015-3-16
收藏
 问题点数:0 回复次数:0 
关于模拟ATM机模拟程序
运行出现了一个错误,希望大家看一下:
#include<stdio.h>
#include<stdlib.h>
void main()
{
    char key,CMmoney;
    int password,password1=123,i=1,a=1000;
    while(1)
    {
        do
        {
            system("cls");
            printf("*************************\n");
            printf("*  please select key:   *\n");
            printf("*  1.password           *\n");
            printf("*  2.get money          *\n");
            printf("*  3.return             *\n");
            printf("*************************\n");
            key=getchar();
        }
        while(key!='1'&&key!='2'&&key!='3');
        switch(key)
        {
        case'1':
            system("cls");
            do
            {
                i++;
                printf("  please input password  ");
                scanf("%d",&password);
                if(password1!=password)
                {
                    if(i>3)
                    {
                        printf("wrong!press any key to exit...");
                        getchar();
                        exit(0);
                    }
                    else
                        puts("wrong ,try again");
                }
            }
            while(password1!=password&&i<=3);
            printf("ok!press any key to continue...");
            getchar();
        case'2':
            do
            {
                system("cls");
                if(password1!=password)
                {
                    printf("please logging in,press any key to continue...");
                    getchar();
                    break;
                }
                else
                {
                    system("cls");
                    printf("*************************\n");
                     printf("*  please select        *\n");
                    printf("*  1.100$               *\n");
                     printf("*  2.200$               *\n");
                    printf("*  3.300$               *\n");
                    printf("*  4.return             *\n");
                    printf("*************************\n");
                    CMmoney=getchar();
                }
                while(CMmoney!='1'&&CMmoney!='2'&&CMmoney!='3');
                switch(CMmoney)
                {
                case'1':
                    system("cls");
                    a=a-100;
                    printf("*************************\n");
                     printf("*  your credit money is $100,thank you!    *\n");
                    printf("*  the balance is $%d.                   *\n",a);
                    printf("*  press any key to return...              *\n");
                    printf("*************************\n");
                    CMmoney=getchar();
                    break;
                case'2':
                    system("cls");
                    a=a-100;
                    printf("*************************\n");
                     printf("*  your credit money is $200,thank you!    *\n");
                    printf("*  the balance is $%d.                   *\n",a);
                    printf("*  press any key to return...              *\n");
                    printf("*************************\n");
                    CMmoney=getchar();
                    break;
                case'3':
                       system("cls");
                    a=a-100;
                    printf("*************************\n");
                     printf("*  your credit money is $300,thank you!    *\n");
                    printf("*  the balance is $%d.                   *\n",a);
                    printf("*  press any key to return...              *\n");
                    printf("*************************\n");
                     CMmoney=getchar();
                    break;
                case'4':
                    break;
                }
                break;
                case'3':
                    printf("*************************\n");
                      printf("*  thank you for your using!    *\n");
                    printf("*  goodbye!                     *\n",a);
                    printf("*************************\n");
                    getchar();
                    break;
            }
            break;   
        }
}
搜索更多相关主题的帖子: password include please system money 
2015-03-16 15:12
快速回复:关于模拟ATM机模拟程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049252 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved