zoukankan
html css js c++ java
ATM取款机系统模拟仿真
#!/bin/sh HOSTNAME="localhost" #数据库信息 PORT="3306" USERNAME="root" PASSWORD="" #数据库名称 DBNAME="bank" TABLENAME="user" #两个标记,用于判断是否超过输入 flag=1 flag1=1 #输入帐号密码成功后进行接下来操作 main() { echo "Please input what do you want to do ?(1、Balance inquiries 2、Change Password 3、draw money 4 、Deposit 5、exit) " read choice case $choice in #查询余额 1 ) select_sql_money_now="select money from ${TABLENAME} where name='$name'" nowmoney=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_money_now}" |awk '{print $1}'|tail -n1` echo "Balance inquiries is $nowmoney ¥" main ;; #修改密码 2) echo "Please input the new password" read newpassword update_sql_password="update $TABLENAME set password=$newpassword where name='$name'" mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${update_sql_password}" main ;; #取款 3) echo "Please input how money do you want draw money" read draw select_sql_money_now="select money from ${TABLENAME} where name='$name'" nowmoney=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_money_now}" |awk '{print $1}'|tail -n1` if [[ $draw -gt $nowmoney ]] then echo "The card money is little" main else let "nowmoney=$nowmoney-$draw" update_sql="update $TABLENAME set money=$nowmoney where name='$name'"; mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${update_sql}" fi main ;; #存款 4)echo "Please input how money do you want Deposit money" read deposit select_sql_money_now="select money from ${TABLENAME} where name='$name'" nowmoney=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_money_now}" |awk '{print $1}'|tail -n1` let "nowmoney=$nowmoney+$deposit" update_sql="update $TABLENAME set money=$nowmoney where name='$name'"; mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${update_sql}" main ;; #退出系统 5) echo "Now you level the system!!" exit ;; esac } #输入密码函数 passwordfun() { read password select_sql_pass="select password from ${TABLENAME} where name='$name'" realpassword=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_pass}" |awk '{print $1}'|tail -n1` if [[ $password -eq $realpassword ]] then main #密码不对,重新输入 elif [[ $password -ne $realpassword ]] then let "flag++" if [[ $flag -gt 4 ]] then echo "you password enter three times ,the system quit !!" exit 0 fi echo "sorry passwors is wrong,Please input password again" passwordfun fi } echo "Please input the card name:" #输入用户名 #输入用户函数进行判断 namefun() { read name select_sql_name="select name from ${TABLENAME} where name='$name'" real=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_name}" |awk '{print $1}'|tail -n1` if [[ -n $real ]] ; then echo "Please input the password:" passwordfun #帐号不对,重新输入 else let "flag1++" if [[ $flag1 -gt 4 ]] then echo "you name enter three times ,the system quit !!" exit 0 fi echo "sorry name is wrong,Please input name again" namefun fi } namefun
查看全文
相关阅读:
我已经迷失在事件环(eventloop)中了【Nodejs篇】
canvas练手项目(二)——各种操作基础
canvas练手项目(三)——Canvas中的Text文本
canvas练手项目(一)——选取图片
迭代器,生成器(generator)和Promise的“微妙”关系
通过HTTP的HEADER完成各种骚操作
这份Koa的简易Router手敲指南请收下
KOA的简易模板引擎实现方式
扒一扒PROMISE的原理,大家不要怕!
参考KOA,5步手写一款粗糙的web框架
原文地址:https://www.cnblogs.com/linuxer/p/2441243.html
最新文章
HDOJ 2242 考研路茫茫——空调教室
HDOJ 1520 Anniversary party(树DP)
HDOJ 4267 A Simple Problem with Integers
HDOJ 3586 Information Disturbing(二分答案+树DP)
HDOJ 3697 Selecting courses (贪心)
HDOJ 4003 Find Metal Mineral (树DP)
Hello World
捕获未处理的异常
nhibernate3 linq的的select 操作 YI
sysbase.db 密码忘记后,添加个用户 YI
热门文章
windows下Ice php客户端配置 YI
apache php tomcat安装1(windows下) YI
apache php tomcat安装2(linux下) YI
nhibernate3 linq的where操作 YI
nhibernate3 分页1 YI
nhibernate 执行sql类 YI
nvelocity封装类凑合着用 YI
wpf datagrid 最后一列空 YI
nhibernate ntext btys 被截断 YI
wpf使用activex YI
Copyright © 2011-2022 走看看