资源简介
活期储蓄处理中,储户开户、销户、存入、支出活动频繁,系统设计要求:
能比较迅速地找到储户的帐户,以实现存款、取款记账;
能比较简单,迅速地实现插入和删除,以实现开户和销户的需要。

代码片段和文件信息
#include
#include
#include
struct link *kaihu(struct link *head);
struct link *xiaohu(struct link *head);
chakan(struct link *head);
cunkuan (struct link *head);
qukuan(struct link *head);
struct link
{
int id;
char name[10];
int num;
struct link *next;
};
main()
{
int i;
char c;
struct link *head=NULL;
printf(“是否需要办理业务(y/n)“);
scanf(“%c“&c);
while(c==‘y‘)
{
printf(“请选择需要的业务 1 开户 2 销户 3 存款 4 取款 5 查询“);
scanf(“ %d“&i);
switch(i)
{
case 1:
head=kaihu(head);
break;
case 2:
head=xiaohu(head);
break;
case 3:
qukuan(head);
break;
case 4:
cunkuan(head);
break;
case 5:
chakan(head);
break;
default:
printf(“命令非法“);
}
printf(“是否需要继续办理其它业务(y/n)\n“);
scanf(“ %c“&c);
}
}
struct link *kaihu(struct link *head)
{
struct link *p=NULL;
struct link *pr=head;
int id ;
char name[10];
int num;
p=(struct link *)malloc(sizeof(struct link));
if(p==NULL)
{
printf(“ error“);
exit(0);
}
if(head==NULL)
{
head=p;
}
else
{
while(pr->next!=NULL)
{
pr=pr->next;
}
pr->next=p;
}
pr=p;
printf(“ 请输入储户编号\n“);
scanf(“%d“&id);
pr->id=id;
printf(“请输入储户姓名\n“);
scanf(“%s“pr->name);
printf(“请输入金额\n“);
scanf(“%d“&num);
pr->num=num;
pr->next=NULL;
return head;
}
struct link *xiaohu(struct link *head)
{
int j;
struct link *p=head*pr=head;
printf(“请输入账户id\n“);
scanf(“%d“&j);
if(head==NULL)
{
printf(“error“);
}
while(j!=p->id&&p->next!=NULL)
{
pr=p;
p=p->next;
}
if(j==p->id)
{
if(p==head)
{
head=p->next;
}
else
{
pr->next=p->next;
}
free(p);
}
else
{
printf(“无此账户“);
}
return head;
}
qukuan(struct link *head)
{
int mn;
struct link *p=head*pr=head;
if(head==NULL)
{
printf(“error“);
}
printf(“请输入账户id“);
scanf(“%d“&m);
printf(“请输入存款金额“);
scanf(“%d“&n);
while(m!=p->id&&p->next!=NULL)
{
pr=p;
p=p->next;
}
if(m==p->id)
{
p->num=p->num+n;
}
}
cunkuan (struct link *head)
{
int mn;
struct link *p=head*pr=head;
if(head==NULL)
{
printf(“error“);
}
printf(“请输入账户id:“);
scanf(“%d“&m);
printf(“请输入取款金额“);
scanf(“%d“&n);
while(m!=p->id&&p->next!=NULL)
{
pr=p;p=p->next;
}
if(m==p->id)
{
if(p->num {
printf(“余额不足\n“);
}
else
{
p->num=p->num-n;
}
}
}
cha
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 184389 2009-05-11 21:19 test.exe
文件 3461 2009-05-11 21:19 test.c
----------- --------- ---------- ----- ----
187850 2
相关资源
- C语言课程设计
- 利用C++哈希表的方法实现电话号码查
- c语言电子商务系统
- 学校超市选址问题(数据结构C语言版
- 数据结构,迷宫问题C语言版源代码
- DSDEMO-C演示(数据结构C语言版 严蔚敏
- 数据结构 图的遍历源代码
- 数据结构实验源代码集
- 实验报告:数据结构长整数四则运算
- 宠物管理系统课程设计(源码+数据库
- 数据结构教程李春葆第五版书中例题
- c语言课程设计:客房登记系统源码
- 吕鑫vc6c++数据结构视频源码
- 数据结构教程李春葆第五版课后答案
- 李春葆课后习题答案(数据结构教材
- 8位竞赛抢答器的课程设计报告.docx
- 数据结构1800题 题+答案(全)
- 数据结构(C语言版)ppt课件,清华,
- c++常用游戏算法及数据结构设计
- 数据结构超全面复习导图
- VC++MFC课程设计的学生成绩管理系统
- 《Data Structures and Algorithm Analysis in C
- 数据结构C语言版教学笔记严蔚敏
- C++实现21点游戏
- c++课程设计学生管理系统浙工大源码
- 数据结构C语言版期末考试试题(有答
- 多功能计算器实现C++代码以及代码详
- C语言数据结构银行客户排队
- C语言实现栈操作
- 课程设计: MFC 学生信息管理系统
评论
共有 条评论