C语言模拟ATM机界面
虽然是满屏的printf、printf、printf、printf、、、、、、尴尬
但是一个小项目做下来还是能学习到很多的,有很多小的问题,不是亲自来敲一遍代码,是不会发现的。他的框架,每一个小函数功能的实现,
很多函数之间的关系,之间参数的传递等等。都是需要考虑的问题。
记得某位C 大神说过,只有在亲身实践中才能学习到真正的东西。另有古人云:键盘不敲烂,月薪不过万。。。。。
凡事从小处着手,慢慢的接近大项目,才是正道。好了废话不多说
先看头文件吧,
#ifndef MAIN_H
#define MAIN_H #include "stdio.h"
#include "math.h" int check_balance(int);
int drewmoney(int);
int reset_password(int);
void take_card();
int save_money(int ); #endif
主函数:
#include "main.h" int main()
{
int account_temp,password_temp,slect_temp;
int account = ;//账户
int password = ;//密码
int balance = ;//余额
printf("welcome to use the ATM !\n\n");
while()
{
printf("please input your account number :");
scanf("%d",&account_temp);
printf("please input your password :");
scanf("%d",&password_temp); if (account_temp==account&&password_temp==password)
{
printf("your account balance is : %d\n\n",balance);
break;
}
else
{
printf("account or password error!!\n");
continue;
}
} do
{
printf("**************\n");
printf("1.check the balance.\n");
printf("2.withdrew money.\n");
printf("3.reset password.\n");
printf("4.take card.\n");
printf("5.save money.\n");
printf("**************\n");
printf("\n\t\t please Select the project you want to serve:\n");
scanf("%d",&slect_temp); switch(slect_temp)
{
case :
check_balance(balance);
break;
case :
balance = drewmoney(balance);
break;
case :
password = reset_password(password);
break;
case :
take_card();
break;
case :
balance = save_money(balance);
break;
}
}while(slect_temp!=);
return ;
}
小函数的实现:
#include"main.h" //查询账户余额
int check_balance(int balance)
{
int b;
b = balance;
printf("your account balance is :%d $\n\n",b);
} //取钱,输入要取金额,金额不足,更新余额。
int drewmoney(int balance)
{
int drew_account,deviation;
printf("please input the account you want to drew :");
scanf("%d",&drew_account);
deviation = balance - drew_account;
if(deviation < )
printf("your account balance is not enough!\n");
else printf("please keep your cash: %d $\n",drew_account); return deviation; //返回余额
} //重置密码,返回新密码
int reset_password(int password)
{
int original,new_pass;
while()
{
printf("please input the original password:\n");
scanf("%d",&original);
if(original==password)
break;
else
{
printf("input error!!\n");
continue;
}
} while()
{
printf("please input your new password with Six digit number:\n");
scanf("%d",&password);
printf("please input again:\n");
scanf("%d",&new_pass);
if(password == new_pass)
{
if(new_pass>&&new_pass<)
{
printf("reset success!!\n\n");
break;
}
else
{
printf("input error!!\n");
continue;
} }
else
{
printf("input error --> not same!!\n");
continue;
} }
return password;
} void take_card()
{
printf("please take your card!!\n\n");
} //存钱,返回新的余额
int save_money(int balance)
{
int save_account;
printf("please input the save account:\n");
scanf("%d",&save_account);
if(save_account<)
printf("sorry,no negative account!!\n");
else
printf("you have saved money %d $\n",save_account);
return balance+save_account;
}
运行效果

C语言模拟ATM机界面的更多相关文章
- 01、模拟ATM机界面程序
一.概述 设计一个简单的模拟自动取款机ATM界面的程序,实现用户登录及取款等功能. 二.需求分析 (1)模拟自动取款机ATM界面,有常用功能. (2)主要功能包括;用户输入密码登录主界面.取款功能.取 ...
- 语言模拟ATM自动取款机系统
C语言实验报告 题目名称:C语言模拟ATM自动取款机系统 C语言模拟实现ATM自动取款机功能:输入密码,余额查询,取款,存款,转账,修改密码,退出功能: 代码实现的功能: 账号及密码输入: ...
- 模拟ATM机银行系统
淄博汉企Java基础考核项目 模拟银行自助终端系统 一. 本系统模拟银行用户使用ATM机开户.查询.存款.取款功能,要求使用java语言编程实现. 说明: 1. 对于数据输入异常,可使用java异常处 ...
- 连接数据库——模拟ATM机查、存、取、开户功能
1.界面:包含开户.查询.存款.取款.功能 package com.bank.test; /** * * @author Administrator *界面类 */ public class Jiem ...
- emWin实现ATM机界面设计,含uCOS-III和FreeRTOS两个版本
第1期:ATM机配套例子:V6-900_STemWin提高篇实验_ATM机(uCOS-III)V6-901_STemWin提高篇实验_ATM机(FreeRTOS) 例程下载地址:http://foru ...
- C 语言之银行ATM机界面
其实就是简单地对switch的用法,希望能给广大读者一些思路,写出自己的创意界面. #include <stdio.h> void main() { char SelectKey,Cred ...
- 序列化,反序列化,模拟ATM机
package com.bank.unionpay; //银行卡的接口 public interface I_yinhangka { //抽象方法 //public abstract默认修饰抽象的 p ...
- 模拟ATM机将输入的数据插入数据库
ATM抽象类 public abstract class ATM { private double balance; private String idcard; private String pas ...
- 简单的小程序实现ATM机操作
简单的小程序实现ATM机操作 代码如下: package Day06; import java.util.Scanner; public class TestAccount { public stat ...
随机推荐
- 标题添加菜单HeaderContextMenu
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Co ...
- android EditText设置光标、边框和图标,以及限制输入
控制边框形状,先在drawable中建一个xml文件:shape.xml <?xml version="1.0" encoding="utf-8"?> ...
- Python 字符串切片
#-*- coding:utf-8 -*- #字符串切片 names = "abcdefgh" ''' 切片语法 names[起始位置:终止位置:步长] 起始位置:即字符串的下标, ...
- Understanding the difficulty of training deep feedforward neural networks
本文作者为:Xavier Glorot与Yoshua Bengio. 本文干了点什么呢? 第一步:探索了不同的激活函数对网络的影响(包括:sigmoid函数,双曲正切函数和softsign y = x ...
- 【转】IIS日志-网站运维的好帮手
对于一个需要长期维护的网站来说,如何让网站长久稳定运行是件很有意义的事情. 有些在开发阶段没有暴露的问题很有可能就在运维阶段出现了,这也是很正常的. 还有些时候,我们希望不断地优化网站,让网站更快速的 ...
- Codeforces Round #Pi (Div. 2) —— D One-Dimensional Battle Ships
题目的意思是: 如今有一个长度为n,宽为1的方格,在上面能够放大小为1*a船,然后输入为n,k,a.分别为平地的大小,船的数量,船的长度. 一个叫alice的人已经在地图上摆好了船的位置. 然后bob ...
- Python3的tcp socket接收不定长数据包接收到的数据不全。
Python Socket API参考出处:http://blog.csdn.net/xiangpingli/article/details/47706707 使用socket.recv(pack_l ...
- Unity中坐标系转换方法
前言 本篇文章主要是参考<Unity API 解析>---陈泉宏. 这是本人在学校图书馆找到一本书,主要介绍的就是常用的类,比较实用,没有冗余的地方.在此推荐一下这本书! 一.Screen ...
- PureMVC--一款多平台MVC框架
官网:http://puremvc.org/ 下载:https://github.com/PureMVC/puremvc-csharp-multicore-framework/tree/1.1.0 A ...
- js表单计算金额问题
<table width="600" border="1" align="center" style="text-align ...