找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 6845|回复: 1

[代码与实例] 简易银行ATM存取款系统

50

主题

1057

帖子

1108

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1108

活跃会员热心会员最佳导师默默耕耘突出贡献优秀版主荣誉管理论坛元老

blueelwang 发表于 2013-12-24 09:21:38 | 显示全部楼层 |阅读模式
  1. ID = 999
  2. PASSWORD = 111
  3. MONEY = 10000
  4. ID_ZHUAN = 123
  5. IS_GOON = 0
  6. WRONGTIME = 0
  7. print("欢迎使用幻蓝ATM存取款一体机。")
  8. while (IS_GOON == 0) :
  9.     if WRONGTIME > 0 :
  10.         print("输入错误,请重新输入。")
  11.     print("请输入您的卡号:")
  12.     id = int(input())
  13.     print("请输入您的密码:")
  14.     password = int(input())
  15.     if id == ID and password == PASSWORD :
  16.         IS_GOON = 1
  17.     else :
  18.         WRONGTIME += 1
  19.         if WRONGTIME > 2 :
  20.             print("您密码输入错误次数已超过3次,感谢您的使用。")
  21.             break
  22. print("---------------------------------------")
  23. while IS_GOON == 1 :
  24.     print("请选择您需要操作的项目:")
  25.     print("1.存款")
  26.     print("2.取款")
  27.     print("3.转账")
  28.     print("4.查看余额")
  29.     print("5.修改密码")
  30.     print("---------------------------------------")
  31.     num_caozuo = int(input())
  32.     if num_caozuo == 1 :
  33.         print("请输入您要存入的金额:")
  34.         money = int(input())
  35.         MONEY = MONEY + money
  36.         print("存款成功。")
  37.         print("您当前的余额为:",MONEY)
  38.     elif num_caozuo == 2 :
  39.         print("请输入您要取出的金额:")
  40.         money = int(input())
  41.         if money < MONEY :
  42.             MONEY = MONEY - money
  43.             print("取款成功。")
  44.             print("您当前的余额为:",MONEY)
  45.         else :
  46.             print("取款失败,账户余额不足。")
  47.     elif num_caozuo == 3 :
  48.         print("请输入您要转入的账户ID:")
  49.         id_zhuan = int(input())
  50.         if id_zhuan == ID_ZHUAN :
  51.             print("请输入您要转出的金额:")
  52.             money = int(input())
  53.             if money < MONEY :
  54.                 print("转账成功。")
  55.             else :
  56.                 print("帐户余额不足。")
  57.         else :
  58.             print("您想转入的账号不存在。")
  59.     elif num_caozuo == 4 :
  60.         print("您当前的余额为:",MONEY)
  61.     elif num_caozuo == 5 :
  62.         print("请输入您的原密码:")
  63.         password = int(input())
  64.         if password == PASSWORD :
  65.             print("请输入您的新密码:")
  66.             password_new1 = int(input())
  67.             print("请再次输入您的新密码:")
  68.             password_new2 = int(input())
  69.             if password_new1 != password_new2 :
  70.                 print("两次密码输入不一致,取消修改。")
  71.             else :
  72.                 PASSWORD = password_new1
  73.                 print("修改成功。")
  74.         else :
  75.             print("当前密码输入错误,取消修改。")
  76.     print("---------------------------------------")
  77.     print("是否还需要进行其他操作:(是请输入1,否请输入2)")
  78.     is_goon = int(input())
  79.     if is_goon == IS_GOON :
  80.         continue
  81.     else :
  82.         print("感谢您的使用,再见。")
复制代码

回复

使用道具 举报

0

主题

1

帖子

1

积分

贫民

积分
1
wt9999 发表于 2016-8-19 16:08:09 | 显示全部楼层
转账功能根本就没有实现嘛
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表