资源描述
银行业务管理系统算法与数据结构
47
2020年5月29日
文档仅供参考
- 第二学期
XXXX学院数学与计算机科学学院
<算法与数据结构课程设计>
综合设计报告
课程设计名称: 银行业务管理模拟
专 业: 计算机科学与技术
班 级: 0X计本(X)班
学 号: 0X0X030XX
姓 名: 高XX
指 导 教 师: 肖XX
课程设计报告
设计项目编号
01
名称
银行业务管理模拟
实验课时
5
主要仪器设备
PC机
附属设备
优盘
主要使用软件
Win-TC
实验时间
3月-5月
1.问题的描述和分析
商业银行业务模拟是对商业银行柜面业务进行模拟实习课程。随着金融业和信息技术的不断发展,银行的管理也已经和计算机接轨,实现了信息的数字化管理,了解并掌握商业银行柜台,周期业务的实际操作处理方法,了解现今商业银行综合业务系统的软件应用,着重于对学生实际操作能力的训练,使学生能初步具备工作岗位的适应各个业务的编程操作能力。多了解各行业编程需求,减少学生踏上工作岗位的适应磨合时间,提高就业竞争力,突出应用型人才的培养目标。
下面我将对现行银行业务管理进行小部分模拟设计。
◆ 写一个上述银行业务管理系统,能够实现一些常见功能,如:制卡,发卡,存款,取款。用于对用户信息进行管理,并能进行修改,查找,显示,求和等操作。
2.算法的设计
概要设计:
银 行 业 务 管 理 模 拟
统
存款
取款
报表
消费
查找记录
改密
退出
制卡
发卡
◆ 建立银行卡管理系统,该系统的主要模块为:
(1)实现系统内制卡、发卡功能;
(2)实现系统内帐户和相关帐户管理;
(3)实现卡交易和合法性检查;
(4)实现卡金融交易积分功能;
(5)实现卡报表功能;
(6)数据以文件形式存储
在编辑过程中,需要使用串,查找等算法,同时需要对输入的信息进行存储。
在制卡发卡后,对用户的信息进行查找,并显示出来。
void load() {
FILE *fp1;
if((fp1=fopen("c://user.txt","r"))==NULL)
{
printf("\nCan not open the file\n");
exit(0);
}
for(N=0;!feof(fp1);N++)
{
fscanf(fp1,"%d%s%s%s%f%d%d",&u[N].cardNO,u[N].name,u[N].adnum,u[N].code,&u[N].left,&u[N].exp,&u[N].flag);
return(N);
}
fclose(fp1);
}
3.数据结构的设计
串是非数值处理中的主要对象,我们一般用串来表示字符流。而这个程序中要处理的就是银行类的字符流,因此我们需要用到串来实现这一功能。串的存储表示有三种形式,第一种是定长顺序存储结构。第二种是块链式存储结构。第三种是堆分配存储结构。
在这里,我们采用串的第一种存储方式——定长顺序存储,而在程序编译时,要给出确定的空间大小,因此我们将串的空间大小设计为100个字符。
#define MAXSIZE 100
结构体定义如下:
struct user u[ ] /*信用卡结构体*/
{
int cardNO; /*卡数*/
char name[20]; /*姓名*/
char adnum[22]; /*信用卡号*/
char code[8]; /*密码*/
float left; /*余额/存款*/
int exp; /*消费*/
int flag; /*确定是新卡还是旧卡*/
}u[M];
4.具体程序的实现
首先是系统内的制卡功能:
用户输入一个申请的卡号
错误 重新输入
是否有19位 N
Y
卡号已经存在
需要重新输入
记录中卡号 Y
是否已经存在 调函数
N
根据实际对密码等
回菜单
赋初值
#include<stdio.h>
#include <dos.h>
#include<stdlib.h>
#include <string.h>
#define M 100 /*定义的数组上限*/
int N; /*结构体数组下标量*/
int H; /*帮助确定是否保存文件*/
struct user u[ ] /*信用卡结构体*/
{
int cardNO; /*卡数*/
char name[20]; /*姓名*/
char adnum[22]; /*信用卡号*/
char code[8]; /*密码*/
float left; /*余额/存款*/
int exp; /*消费*/
int flag; /*确定是新卡还是旧卡*/
}u[M];
5.界面设计
本程序的主控菜单如下:
1.申请一个卡号
2.使用这个卡号
3.打印消费记录
4.存款功能
5.取款功能
6.消费功能
7.报表功能
8.查找消费记录
9.修改密码
int menu(void)
{ int x;
do
{
printf("\t\t<*******************menu************************>\n");
printf("\t\t|| (1)Apply for one blank card ||\n");
printf("\t\t|| (2)Use one blank card ||\n");
printf("\t\t|| (3)Print the record ||\n");
printf("\t\t|| (4)Store the money ||\n");
printf("\t\t|| (5)Fetch the money ||\n");
printf("\t\t|| (6)Spend the money ||\n");
printf("\t\t|| (7)Save the file ||\n");
printf("\t\t|| (8)Search the record ||\n");
printf("\t\t|| (9)Change the passward ||\n");
printf("\t\t|| (0)quit the system ||\n");
printf("\t\t\tPlease input your choice (0-10):( )\b\b\b");
scanf("%d",&x);
if(x<0||x>10)
{
printf("\t\t\t Error! Input again.");
}
}while(x<0||x>10);
return (x);
}
(1) .制卡
void make(struct user u[])
{
int i;
char a[22];
load(); /*读取文件中的可用空卡条数*/
do
{
printf("\n\nEnter the AD number of the card:\n");
scanf("%s",a);
if(strlen(a)!=19)
{
printf("\n\n\n\t\t**** Mistaken ID,please enter again*********\n\n");
continue;
}
for(i=0;i<N;i++)
if(strcmp(u[i].adnum,a)==0)
{
printf("\n\n\t\t*** The AD number exists,please enter again ***\n\n");
break;
}
}
while(((strlen(a))!=10)||strcmp(u[i].adnum,a)==0);
u[N].cardNO=N;
strcpy(u[N].name,"***");
strcpy(u[N].adnum,a);
strcpy(u[N].code,"000000");
u[N].flag=-1;
u[N].left=0.00;
u[N].exp=0;
N++;
H=1;
printf("\n\n\n\t\t************* Successfully applied!*************\n\n");
printf("\n\n\tPress any key to return.....\n\n");
getchar();
}
其中
void load() {
FILE *fp1;
if((fp1=fopen("c://user.txt","r"))==NULL)
{
printf("\nCan not open the file\n");
exit(0);
}
for(N=0;!feof(fp1);N++)
{
fscanf(fp1,"%d%s%s%s%f%d%d",&u[N].cardNO,u[N].name,u[N].adnum,u[N].code,&u[N].left,&u[N].exp,&u[N].flag);
return(N);
}
fclose(fp1);
}
使用该程序,要现在c盘建立一个名为user.txt的文件。
(2) 发卡:
void deliever(struct user u[]) {
{
int i;
char a[20];
float b;
char code2[8];
for(i=0;i<=N;i++)
if(u[i].flag==-1) /*-1是新申请的卡特有的值*/ {
printf("\n\n\t\t1.Please enter your name:");
scanf("%s",a);
strcpy(u[i].name,a);
printf("\n\t\t2.Code:");
scanf("%s",u[i].code);
printf("\n\t\t3.Code again:");
scanf("%s",code2);
while(stricmp(u[i].code,code2)!=0) /*输入的密码两次应该相同*/
{
printf("Your two codes are not identical,please input them again!");
printf("\n\t\t\tCode:");
scanf("%ld",&u1.code);
printf("\n\t\t\tCode again:");
scanf("%ld",&code2);
}
strcpy(u[i].code,a);
printf("\n\n\t\tThe money you want to store:");
scanf("%f",&b);
printf("\n\n");
u[i].left=b;
u[i].flag=1; /*1是使用的卡特有的值*/
H=1;
printf("\n\n\t\t********* You can use the card!Congratulations! *********\n\n");
printf("\n\n\t\t Press any key to return..... \n\n");
getchar();
break;
}
if(i>N)
{
printf("\n\n\n\t\t**************Have no free card,please make one!***************\n\n");
printf("\n\n\tPress any key to return.....\n\n");
getchar();
}
}
流程:输入姓名 两次密码确定值相同之后 存入一定金额就能够使用信用卡了
(3) .取款
void fetch(struct user u[])
{
float money; /*money要取的数目*/
int i,j=0; /*j记录同名的人数 */
int logic=0,account=0;
/*logic记录是否在文件中找到使用者信息 accout记录输入密码次数 上限为3次*/
int num[10]; /*记录同名的人在文件中的位置即条数 */
char a[20],b[6];
printf("\n\n\t\tPlease input your name:");
scanf("%s",a);
for(i=0;i<=N;i++)
if(strcmp(u[i].name,a)==0)
{
num[j]=i; /*查找是第几条记录*/
j++;
}
if(j==0)
printf("\n\n\t\t********* Can not find the record of the person %s! *********\n\n",a);
if(j>1)
{
printf("\n\nEnter the AD number of the card:(\t\t )\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
scanf("%s",a);
for(i=0;i<j;i++)
if(strcmp(u[num[i]].adnum,a)==0)
{
logic=1;
num[j-1]=num[i];
/*把数组中最后一个非零元素赋为正确的信息所在位置*/
break;
}
if(logic==0)
printf("\n\n\t\t*** The record does not exist. ***\n\n\n");
}
if(j==1||logic==1)
do
{
printf("\n\nPlease Enter the code :( )\b\b\b\b\b\b\b");
scanf("%s",b);
if(strcmp(u[num[j-1]].code,b)==0)
{
printf("\n\n\tThe money left is:");
printf("%f\n\n",u[num[j-1]].left);
do
{
printf("\nHow much do you want to fetch:");
scanf("%f",&money);
if(money>u[num[j-1]].left)
printf("\n\n\t Balance Difficiency!");
}while(money>u[num[j-1]].left);
break;
}
else
{
printf("\n\n\t\t************* Mistaken code--Try again*************\n\n");
account++;
}
}while(account<3);
if(account<3)
{
u[num[j-1]].left-=money;
H=1;
printf("\n\n\t\t**** Fetch Successful**** \n\n");
}
else
{
printf("\n\n\t\t****************Fetch failue **********************\n\n\n");
printf("\n\n\tPass any key to return.....\n\n");
getchar();
}
}
(4) .存款
void deposit(struct user u[]) /*存储 定义变量意义基本与取款函数相同*/
{
float money;
int i,j=0;
int logic=0,account=0;
int num[10];
char a[20],b[6];
printf("\n\nPlease enter your name:");
scanf("%s",a);
for(i=0;i<=N;i++)
if(strcmp(u[i].name,a)==0)
{
num[j]=i;
j++;
}
if(j==0)
printf("\n\n\t\t*** Can not find the record of the person %s! ***\n\n",a);
if(j>1)
{
printf("\n\nEnter the AD number of the card:(\t\t )\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
scanf("%s",a);
for(i=0;i<j;i++)
if(strcmp(u[num[i]].adnum,a)==0)
{
logic=1;
num[j-1]=num[i];
break;
}
if(logic==0)
printf("\n\n\t\t************* The record does not exist.*************\n\n\n");
}
if(j==1||logic==1)
do
{
printf("\n\nEnter the code :( )\b\b\b\b\b\b\b");
scanf("%s",b);
if(strcmp(u[num[j-1]].code ,b)==0)
{
printf("\n\nHow much do you want to deposit:");
scanf("%f",&money);
u[num[j-1]].left+=money;
H=1;
printf("\n\n\t\t************** Successfully deposit !**************\n\n");
break;
}
else
{
printf("\n\n\t\t************* Mistaken code--Try again*************\n\n");
account++;
}
}while(account<3);
if(account==3)
{
printf("\n\n\t\t****** Deposit failue************\n\n\n");
printf("\n\n\tPass any key to return.....\n\n");
getchar();
}
}
(5) .报表
void forms(struct user u[]) /*报表*/
{
int i,page;
do
{
printf("\n\tThere are %d pages !!",N/8+1);
printf("\n\n\tWhich page do you want to check?:( )\b\b");
scanf("%d",&page);
if(page>N/8+1)
{
printf("\n\n\t\t*** Error page you enter--Try again ***");
continue;
}
else
{
printf("\n\t\t\t\tPage (%d )\n",page);
printf("\n\n|----|--------------------|--------------------|----|----------|----------|");
printf("\n|NO. | name | AD |flag| left | exp |");
printf("\n|----|--------------------|--------------------|----|----------|----------|");
for(i=8*(page-1)+1;i<=8*(page-1)+9;i++)
{
printf("\n|%-4d|%-20s|%-20s|%-4d|%-10.2f|%-10d|",u[i-1].cardNO,u[i-1].name,u[i-1].adnum,
u[i-1].flag,u[i-1].left,u[i-1].exp);
printf("\n|----|--------------------|--------------------|----|----------|----------|");
if(i==N)
break;
}
}
}while(page>N/7+1);
printf("\n\n\tPass any key to return......\n");
getchar();
}
(6) .消费
void consume(struct user u[]) /*消费 变量意义同取款函数*/
{
float money;
int i,j=0;
int logic=0,account=0;
int num[10];
char a[20],b[6];
printf("\n\nPlease enter your name:");
scanf("%s",a);
for(i=0;i<=N;i++)
if(strcmp(u[i].name,a)==0)
{
num[j]=i;
j++;
}
if(j==0)
printf("\n\n\t\t*************** Can not find the record of the %s! *************\n\n",a);
if(j>1)
{
printf("\n\nPlease enter the AD number of the card:(\t\t )\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
scanf("%s",a);
for(i=0;i<j;i++)
if(strcmp(u[num[i]].adnum,a)==0)
{
logic=1;
num[j-1]=num[i];
break;
}
if(logic==0)
printf("\n\n\t\t*** The record does not exist.***\n\n\n");
}
if(j==1||logic==1)
do {
printf("\n\nPlease enter the code :( )\b\b\b\b\b\b\b");
scanf("%s",b);
if(strcmp(u[num[j-1]].code ,b)==0)
{
do
{
printf("\n\n\nHow much is the expenditure?:");
scanf("%f",&money);
if(money>u[num[j-1]].left)
printf("\n\n\t Balance Difficiency!");
}while(money>u[num[j-1]].left);
u[num[j-1]].left-=money;
u[num[j-1]].exp+=money;
H=1;
printf("\n\n\n\t\t***** Pay for successful *******\n\n");
break;
}
else
{
printf("\n\n\t\t*** Mistaken code--Try again***\n\n");
account++;
}
}while(account<3);
if(account==3)
{
printf("\n\n\t\t****** Failue Consume ************\n\n\n");
printf("\n\n\tPress any key to return.....\n\n");
getchar();
}
}
(7).改密码:
void change(struct
展开阅读全文