银行系统——框架

问题及代码:

/*  
* Copyright (c) 2014, 烟台大学计算机学院  
* All rights reserved.  
* 文件名称:yinhang.cpp  
* 作    者:夏焕哲 
* 完成日期:2014 年 11  月  15  日  
* 版 本 号:v1.0   
* 问题描述:建立一个银行存取转业务程序。  
* 输入描述: 输入一个密码和服务项目。  
* 程序输出: 相应结果。  
*/    
#include <iostream>

using namespace std;

const int PASSWORD=123456;
int password ;
int sum=1000000;
int take;
int give;
int bring;//give:转账。take:取款。bring:存款。sum:一开始就在银行中的钱。
int main()
{
    int number;
    cout<<".....................夏氏银行欢迎您......................"<<endl;;
    cout<<"请输入密码:";
    cin>>password;
    do
    {
        if (password==PASSWORD)
        {
            cout<<"您可以办理下面的业务:"<<endl;
            cout<<"1.查询"<<endl;
            cout<<"2.取款"<<endl;
            cout<<"3.存款"<<endl;
            cout<<"4.转账"<<endl;
            cout<<"0.退出"<<endl;
            cout<<"请输入(0-4):"<<endl;
            do
            {
                cin>>number;
                switch (number)
                {
                case 1:
                    cout<<"您的余额还有"<<sum<<endl;;
                    continue;
                case 2:
                    cout<<"请输入取款金额:";
                    cin>>take;
                    sum=sum-take;
                    continue;
                case 3:
                    cout<<"请输入你要存入的金额";
                    cin>>bring;
                    sum=sum+bring;
                    continue;
                case 4:
                    cout<<"请输入你要转账的金额";
                    cin>>give;
                    sum=sum-give;
                    continue;
                case 0:
                    cout<<"谢谢,欢迎下次光临。";
                    break;
                default:
                    cout<<"输入错误,不要着急。"<<endl;;
                    continue;
                }
                if (number==0)break;
            }
            while (1);

        }

        else
        {
            cout<<"密码错误请重新输入:";
            cin>>password;
        }
        if (number==0)break;
    }
    while (1);



}

运行结果:

心得体会:学的全用上,好有成就感。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值