C语言课程设计………银行自动存取款机模拟
作者:周鸣
需求分析:
本程序设计的任务为银行自助存取款机,程序要求实现atm机的基本功能,如 开户.查询.存款.取款.转账.容而生成操作日志。
概要设计:
数据类型:int,char,FILE.
主程序流程:int main ()
1:进入dl()函数。
2:核对输入账户与密码。
核对成功则进入dljm()函数。
选择操作功能。
完成操作,回到功能选择一栏。
可选择退卡以结束所有操作。
标准函数名称和自定义名称:
Void dl ()
Void dljm ()
Void cx()
Void ck()
Void qk()
Void zz()
主程序的流程及各函数之间的流程关系。(用图来描述)
#include
#include
int x,k;
void dl();
int dljm();
void cx();
void qk();
void zz();
void ck();
void tk();
FILE *fp;
FILE *fg;
struct atm
{
char name[10];
int account;
short password;
float money;}at[10]={{"AA",1,1,4000},{"BB",2,2,4000},{"CC",3,3,4000},
{"DD",4,4,4000},{"EE",5,5,4000},{"GG",6,6,4000},
{"HH",7,7,4000},{"II",8,8,4000},{"JJ",9,9,4000},
{"kk",10,10,4000}};
void main()
{
char filename[]="zhouming.txt";
char mode[]="w",b[]="AA 1 1 4000 BB 2 2 4000 CC 3 3 4000 DD 4 4 4000 EE 5 5 4000 GG 6 6 4000 HH 7 7 4000 II 8 8 4000 JJ 9 9 4000 KK 10 10 4000";
clrscr();
if((fg=fopen("x.txt","a+"))==NULL)
{printf("cannot open the file zhouming!strike any exit");
getch();
exit(1);}
dl();
if((fp=fopen(filename,mode))!=NULL)
{fputs(b,fp);
fclose(fp);} }
void dl()
{
int account,i,j;
short password;
printf("please enter the card number:");
fprintf(fg,"please enter the card number:\n");
scanf("%d",&account);
fprintf(fg,"%d\n",account);
if(account>10)
dl();
for(k=0;k<=9;k++)
{
if(account==at[k].account)
{ x=k;fprintf(fp,"please enter the card number:%d\n");
printf("please enter password:");
fprintf(fg,"please enter password:\n");
scanf("%d",&password);
fprintf(fg,"%d\n",password);
for(i=1;i<4;i++)
{if(password==at[k].password)
{ fprintf(fg,"please enter the password:%d\n");
printf("log in successfully,please select operation\n");
fprintf(fg,"log in successfully,please select operation\n");
dljm();
break;
}
else
{
printf
如果觉得《c语言课程设计自动取款机 C语言课程设计………银行自动存取款机模拟.doc》对你有帮助,请点赞、收藏,并留下你的观点哦!