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 ...
随机推荐
- Cocos2d-x模版卸载及安装
卸载:将隐藏的模板文件删除掉 首先打开你mac终端,然后输入如下命令:显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -b ...
- atitit.javascript调用java in swt attilax 总结
atitit.javascript调用java in swt attilax 总结 1. BrowserFunction 简单介绍1 1.1. BrowserFunction 能够分为三类: 1 1. ...
- More is better-多多益善
思路:在图中所有的连通分量中找出包含顶点最多的个数.继续使用并查集解决! #include <iostream> using namespace std; ; int tree[MAX]; ...
- c++ c++ 与 Java
1.c++ c++ 如果1个类的定义中包含另一个类,那么在stdafx.h中 被包含的类必须放在包含类的前面,不然编译器找不到被包含类,c++没有包的概念,所以包含头文件时要注意顺序,而java不存在 ...
- Jmeter在命令行运行技巧
For non-interactive testing, you may choose to run JMeter without the GUI. To do so, use the followi ...
- 【Raspberry Pi】openwrt 路由
http://blog.sina.com.cn/s/blog_40983e5e0102v6qt.html
- VC实现波形不闪烁动态绘图 .
http://blog.csdn.net/xuyongbeijing2008/article/details/8064284 源代码:http://www.vckbase.com/index.php/ ...
- 【java】java内存模型(2)--volatile内存语义详解
多线程并发编程中synchronized和Volatile都扮演着重要的角色,Volatile是轻量级的synchronized,它在多处理器开发中保证了共享变量的“可见性”.可见性的意思是当一个线程 ...
- 发布订阅者模式之C#委托实现
1 ...
- python2.0_day16_django_url_view_models_template介绍
本节内容 Django流程介绍 Django url Django view Django models Django template Django form Django admin Django ...