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 ...
随机推荐
- 《FPGA全程进阶---实战演练》第二章之焊接板子及调试注意事项
1.若是读者第一次做板子,强烈建议画完PCB板后将PCB图打印出来,然后对照你买的芯片将芯片放置对 应的位置,然后查看所有的封装格式适不适合,否则等你做出板子来后再试,为时晚矣.笔者虽然知道要这么 做 ...
- php 连接数据库
连接数据库 <?php $con = mysql_connect("localhost","root","root"); if (!$ ...
- am335x LCD背光问题
/**************************************************************** * am335x backlight problem * * 本问记 ...
- windows下定时任务设置
Linux 系统可以通过crontab -e 设置定时任务,Windows系统没有crontab命令,但是Windows系统有跟crontab命令比较接近的命令: schtasks 命令. # 设置定 ...
- e652. Getting the Font Faces for a Font Family
To create a Font object to draw text, it is necessary to specify the font face name. This example de ...
- java中Scanner的nextLine()和next()的区别
首先,next()一定要读取到有效字符后才可以结束输入,对输入有效字符之前遇到的空格键.Tab键或Enter键等结束符,next()方法会自动将其去掉,只有在输入有效字符之后,next()方法才将其后 ...
- 使用ffmpeg的av_read_frame,如何控制连接超时
最近使用ffmpeg来做一个rtsp的客户端,这过程也遇到不少问题,不过相应都比较好,一路走下来.不过到项目结尾时,且遇到一个比较纠结的问题.那就是客户端在使用的过程中,把rtsp服务器的网断了.这时 ...
- vnc远程控制软件怎么用
CC是一款不错的局域网控制软件,它的轻便让人无法相信,下载过该软件的人都知道,该软件只有大小 工具/原料 我这里使用的是vnc-E4_2_9X32中文版 被控制端的安装 1 我们先来被控制电脑 ...
- postman从入门到精通
今天总监让我给测试同事们培训postman,使用过postman的朋友应该知道,这个简直就是前后端接口调试神器.根据平时的经验以及自己到网上看了相关的帖子,对于postman又有了新的认识. post ...
- jQuery-理解事件
一.理解事件 1.什么是事件 事件是Web浏览器通知应用程序(比如我们的js)发生了某个事情! 我们可以为这些特定的事情,事先安排好处理方案,这样就能够实现互动! 2.事件目标 你可以简单的理解为事件 ...