| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3500 人关注过本帖
标题:自编模拟ATM(自动柜员机)界面程序代码
取消只看楼主 加入收藏
wronadlo
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-5-17
收藏
 问题点数:0 回复次数:0 
自编模拟ATM(自动柜员机)界面程序代码
#include<iostream.h>
#include <stdlib.h>
void main()
{
    cout<<"欢迎使用"<<endl;
    char ch,p;
    cout<<"=====================\n";
    cout<<"    a取钱"<<endl;
    cout<<"    b存钱"<<endl;
    cout<<"    c查询余额"<<endl;
    cout<<"    d取卡"<<endl;
    cout<<"=====================\n";
    cout<<"请输入你想执行的:";
    cin>>ch;    
    while(ch!='a'&&ch!='b'&&ch!='c'&&ch!='d')
    {
        cout<<"你输入有误,请重新输入";
        cin>>ch;
    }
    cout<<"======================!";
    int i,j;
    system("cls");

    while(ch!='d')
    {
        switch(ch)
        {
        case'a':
            {
                cout<<"请选择你要取出的金额\n";
                cout<<"1.$50\n";
                cout<<"2.$100\n";
                cout<<"3.$200\n";
                 cout<<"4.退出  \n";
                cin>>p;
                while(p!='1'&&p!='2'&&p!='3'&&p!='4')
                {
                    cout<<"你输入有误,请重新输入";
                    cin>>p;
                }
                system("cls");

                switch(p)
                {
                case'1':cout<<"you gredit money is $50,thank you!\n";break;
                case'2':cout<<"you gredit money is $100,thank you!\n";break;
                case'3':cout<<"you gredit money is $200,thank you!\n";break;
                case'4':cout<<"thank you for using!\n";break;
                }
                break;                
            }
        case'b':
            {                
                int o;
                cout<<"请输入你要存人的数额:"<<endl;
                cin>>o;
            
                int w;
                cout<<"请输入帐号:"<<endl;
                cin>>w;
                cout<<"你存入了"<<o<<"到帐号"<<w<<endl;
                system("cls");
                cout<<"thank you for useing"<<endl;
                break;
            }
        case'c':
            {
                cout<<"你的余额为$1000\n";
                break;
                
            }
            
        }
        break;

        cout<<"thank you for  useing"<<endl;
    }
    
}

感觉里面有不好的地方.请高手指教下..比如如何能在存钱里限制只能输入数字的限制..
 
搜索更多相关主题的帖子: 自动柜员机 ATM 界面 代码 
2008-05-17 17:00
快速回复:自编模拟ATM(自动柜员机)界面程序代码
数据加载中...
 
   



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

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