怎么用c语言数据清零将银行系统中余额清零

(急)!C语言程序设计题---银行帐户管理系统_百度知道
(急)!C语言程序设计题---银行帐户管理系统
帮忙写个程序,C语言课程设计的作业请广大编程问问团队帮我,写完后请运行下能否执行只有几天的时间,写得好的可以再追加分数
要求建立二进制文件存储银行帐户信息,其中每个用户帐户信息中要求保存帐号,用户身份证号码,用户姓名,用户地址,帐户金额等.完成以下...
我有更好的答案
#include&stdio.h&#include&stdlib.h&#include&string.h&#include&conio.h&#define BUFFERSIZE 1024#define MAXACCOUNT 1000typedef struct BankAccount{
char name[32];}BANKACCOUNT;BANKACCOUNT accountCollection[MAXACCOUNT];int curAccount = 0;void InsertAccount(FILE *fp){
BANKACCOUNT
printf(&please input the account information\n&);
printf(&&&account num:&);
scanf(&%d&,&(newaccount.account));
printf(&&&key:&);
scanf(&%d&,&(newaccount.key));
printf(&&&name:&);
scanf(&%s&,newaccount.name);
printf(&&&balance:&);
scanf(&%f&,&(newaccount.balance));
fseek(fp,0L,SEEK_END);
fprintf(fp,&%d %d %s %.2f\n&,newaccount.account,newaccount.key,newaccount.name,newaccount.balance);}void GetAccount(FILE *fp){
char name[32];
int i =0,j;
char buffer[BUFFERSIZE];
curAccount = 0;
fseek(fp,0,SEEK_SET);
while(!feof(fp)) /* 因为feof()最后会读2遍,所以最后curAccount多加了1 */
fscanf(fp,&%d %d %s %f&,&accountnum,&key,name,&balance);
accountCollection[curAccount].account =
accountCollection[curAccount].key =
strcpy(accountCollection[curAccount].name ,name);
accountCollection[curAccount].balance =
curAccount++;
}}void ListAccount(FILE *fp){
printf(&There is %d accounts at all:\n&,curAccount-1);/* curAccount减去多加的1 */
for(i = 0;i& curAccount-1;i++)
printf(&ACCOUNT[%d]:\n&,i+1);
printf(&account:%d\n&,accountCollection[i].account);
printf(&name:%s\n&,accountCollection[i].name);
printf(&balance:%.2f\n&,accountCollection[i].balance);
}}int SearchAccount(FILE *fp,int accountnum){
for(i = 0;i& curAccount-1;i++)
if(accountCollection[i].account == accountnum)
printf(&ACCOUNT[%d]:\n&,i+1);
printf(&account:%d\n&,accountCollection[i].account);
printf(&name:%s\n&,accountCollection[i].name);
printf(&balance:%.2f\n&,accountCollection[i].balance);
return 0;}void DelAccount(FILE *fp,int accountnum){
if(SearchAccount(fp,accountnum)==0)
printf(&Can't find the account\n&);
for(i = 0;i&curAccount-1;i++)
if(accountCollection[i].account != accountnum)
fprintf(fp,&%d %d %s %.2f\n&,accountCollection[i].account,accountCollection[i].key,accountCollection[i].name,accountCollection[i].balance);
printf(&delete successfully!\n&);
}}int main(){
system(&cls&); //清屏
puts(&********************************************&);
You can choose :
1 : Insert a new Account
2 : List all
3 : Find a
4 : Delete a Account
puts(&********************************************&);
printf(&Please input your choice:&);
scanf(&%d&,&i);
system(&cls&); //清屏
fopen(&account.txt&,&a+&)))
printf(&can't open the file account.txt\n&);
InsertAccount( fp);
printf(&press any key to continue.....\n&);
fclose(fp);
fopen(&account.txt&,&r&)))
printf(&can't open the file account.txt\n&);
GetAccount(fp);
ListAccount(fp);
fclose(fp);
printf(&press any key to continue.....\n&);
printf(&please input the account num:\n&);
scanf(&%d&,&accountnum);
fopen(&account.txt&,&r&)))
printf(&can't open the file account.txt\n&);
GetAccount(fp);
if(!SearchAccount(fp,accountnum))
printf(&There is not the account:%d\n&,accountnum);
fclose(fp);
printf(&press any key to continue.....\n&);
printf(&please input the account num:\n&);
scanf(&%d&,&accountnum);
fopen(&account.txt&,&r&)))
printf(&can't open the file account.txt\n&);
GetAccount(fp);
fclose(fp);
fopen(&account.txt&,&w+&)))
printf(&can't open the file account.txt\n&);
DelAccount(fp,accountnum);
fclose(fp);
printf(&press any key to continue.....\n&);
}while(i != 5);
return 0;}这里账户数据文件名已经设定为account.txt,这个文件要和上面这个程序放在同一个文件夹下面,不然就得用绝对路径(比如&d:\\book\\account.txt&),account内容可以用记事本打开自己改动,然后运行程序后就可以在程序中添加或删除。account.txt一个参考内容如下:1 10023 zhangsl 100.502 32001 sunq 5000.003 20010 wangxi
已将程序发至邮箱
最讨厌的是叫别人代写一大段代码了,我只想说,这东西,求人求天,不如求自己。除非拿rmb,否则很少会有人会为了那么几个金币去写的。
1条折叠回答
为您推荐:
其他类似问题
您可能关注的内容
c语言程序设计的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。&>&c语言简单的银行系统
c语言简单的银行系统
上传大小:3KB
本程序是用c语言写的银行系统,欢迎自己修改
综合评分:0
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有0条
综合评分:
积分/C币:3
综合评分:
积分/C币:3
综合评分:
积分/C币:3
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
c语言简单的银行系统
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
无法举报自己的资源
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
举报的资源分:
请选择类型
资源无法下载 ( 404页面、下载失败、资源本身问题)
资源无法使用 (文件损坏、内容缺失、题文不符)
侵犯版权资源 (侵犯公司或个人版权)
虚假资源 (恶意欺诈、刷分资源)
含色情、危害国家安全内容
含广告、木马病毒资源
*详细原因:
c语言简单的银行系统银行存款的C语言编程问题!!!_百度知道
银行存款的C语言编程问题!!!
问题描述:
设银行整存整取不同期限的月利率分别是:活期月息为0.75%,一年期月息为1.75%,三年期月息为2.15%,五年期月息为2.75%,且银行对定期存款过期部分不支付利息。
现在某人将手头多余的钱存入银行,其多余的钱是第一年每月2000元,以后每年每月多余...
我有更好的答案
#include&stdio.h&void f1(float x){float y=0.75*x,for(n=1;n&15;n++){ x=1.08*x;y=x*0.0075;y+=y;x+=x;}printf(&存入现金%f,可得利息%f,它们之和%f&,12*x,12*y,12*(x+y));}void f2(float x){float y=0.0175*x,for(n=1;n&15;n++){x+=0.08*xy+=0.175*x;}printf(&存入现金%f,可得利息%f,它们之和%f&,12*x,12*y,12*(x+y));}int main(){printf(&其多余的钱是第一年每月2000元,以后每年每月多余的钱在上一年队每月多余钱的基础上再增加8%,活期月息为0.75%,一年期月息为1.75%,三年期月息为2.15%,五年期月息为2.75%,且银行对定期存款过期部分不支付利息。&);&)printf(&&&&&&&&&&&&&储蓄问答系统&&&&&&&&&&&&&&&);printf(&请按数字键操作\t&):printf(&\t1.答活期15年本金与利息以及它们之和\n&);printf(&\t2.答1年定期15年本金与利息以及它们之和\n&);printf(&\t3.答3年定期15年本金与利息以及它们之和\n&);printf(&\t4.答5年定期15年本金与利息以及它们之和\n&);printf(&\t0退出\t\t5清屏&);switch(getchar()){case 1: f1(2000);case 2: f2(2000);case 3: f3(2000);case 4: f4(2000);case 5: system(cls&);case 0: exit(1);}那个其他函数类是,我就不再这里编了,时间紧急,没编译过,有问题再请教
采纳率:31%
为您推荐:
其他类似问题
您可能关注的内容
c语言编程的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。银行存款的C语言编程问题_百度知道
银行存款的C语言编程问题
设银行整存整取不同期限的月利率分别是:活期月息为0.75%,一年期月息为1.75%,三年期月息为2.15%,五年期月息为2.75%,且银行对定期存款过期部分不支付利息。
现在某人将手头多余的钱存入银行,其多余的钱是第一年每月2000元,以后每年每月多余的钱在上一年...
我有更好的答案
只写了一部分 其他也差不多。。。。#include&stdio.h&void f1(float x){float y=0.75*x,for(n=1;n&15;n++){ x=1.08*x;y=x*0.0075;y+=y;x+=x;}printf(&存入现金%f,可得利息%f,它们之和%f&,12*x,12*y,12*(x+y));}void f2(float x){float y=0.0175*x,for(n=1;n&15;n++){x+=0.08*xy+=0.175*x;}printf(&存入现金%f,可得利息%f,它们之和%f&,12*x,12*y,12*(x+y));}int main(){printf(&其多余的钱是第一年每月2000元,以后每年每月多余的钱在上一年队每月多余钱的基础上再增加8%,活期月息为0.75%,一年期月息为1.75%,三年期月息为2.15%,五年期月息为2.75%,且银行对定期存款过期部分不支付利息。&);&)printf(&&&&&&&&&&&&&储蓄问答系统&&&&&&&&&&&&&&&);printf(&请按数字键操作\t&):printf(&\t1.答活期15年本金与利息以及它们之和\n&);printf(&\t2.答1年定期15年本金与利息以及它们之和\n&);printf(&\t3.答3年定期15年本金与利息以及它们之和\n&);printf(&\t4.答5年定期15年本金与利息以及它们之和\n&);printf(&\t0退出\t\t5清屏&);switch(getchar()){case 1: f1(2000);case 2: f2(2000);case 3: f3(2000);case 4: f4(2000);case 5: system(cls&);case 0: exit(1);}
为您推荐:
其他类似问题
c语言编程的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。C语言银行储蓄系统源码
转载 &更新时间:日 10:46:23 & 作者:shancx
这篇文章主要为大家详细介绍了C语言银行储蓄系统源码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文为大家分享了C语言银行储蓄系统源码,实现银行的各项功能,供大家参考,具体内容如下
#include &stdio.h&
#include &stdlib.h&
#include &conio.h&
#include &string.h&
void openaccount();//开户
void save();//存款
void withdraw();//取款
void showAccount();//查询
void transferAccounts();//转账
void reportLoss(); //挂失
void cancelLoss(); //解除挂失
void cancelAccount(); //注销账户
void updatePassword();
//更改密码
int load();//登陆账号
int accountnum=0;//定义全局变量,用来计算账户数目
int nowaccount=0;//登录成功是的账户
struct Bank
char account[20]; //账号
char password[10]; //密码
char name[20];
//账户余额
struct Bank banks[100];
int load()
int right=0,i=0,j;
int r1,r2;
char account1[20]= {0};
char password1[10]= {0};
printf("登陆\n请输入账号:\n");
scanf("%s",account1);
printf("请输入密码:\n");
while((ch=getch())!='\r')
password1[i++]=
putchar('*');
for(j=0; j& j++)
r1=strcmp(account1,banks[j].account);
r2=strcmp(password1,banks[j].password);
if(r1==0&&r2==0)
nowaccount=j;
if(banks[j].state==0)
printf("登录成功!\n");//登录成功
else if(banks[j].state==1)
printf("您的账户处于挂失状态,请解挂\n");
else if(banks[j].state==2)
printf("账户已经销户\n");
if(right==0)
printf("登陆失败!\n");
int main()
char a[100];
if((fp=fopen("account.txt","r"))==NULL)
if((fp=fopen("account.txt","w"))==NULL)
printf("失败!\n");
while(fscanf(fp,"%s%s%s%d%d",banks[i].account,banks[i].name,banks[i].password,&banks[i].balance,&banks[i].state)!=EOF)
accountnum++;
fclose(fp);
printf("欢迎来到我的银行\n");
printf("请选择业务:\n");
printf("1.开户
3.取款\n");
printf("4.查询
6.挂失\n");
printf("7.解挂
9.改密\n");
printf("-1.退出\n");
scanf("%s",a);
num=atoi(a);
if(num==1)
openaccount();//开户
else if(num==2)
save();//存款
else if(num==3)
withdraw();//取款
else if(num==4)
showAccount();//查询
else if(num==5)
transferAccounts();//转账
else if(num==6)
reportLoss(); //挂失
else if(num==7)
cancelLoss(); //解挂
else if(num==8)
cancelAccount(); //注销账户
else if(num==9)
updatePassword();
//更改密码
else if(num==-1)
printf("欢迎下次再来\n");
printf("抱歉,没有此业务\n");
if((fp=fopen("account.txt","w"))==NULL)
printf("失败!\n");
for(i=0; i& i++)
fprintf(fp,"%s\t%s\t%s\t%d\t%d\n",banks[i].account,banks[i].name,banks[i].password,banks[i].balance,banks[i].state);
fclose(fp);
void openaccount()
int i=0,j=0;
char password1[10]= {0};
printf("账户(十位数):\n");
scanf("%s",banks[accountnum].account);
while(banks[accountnum].account[i]!='\0')
printf("输入账号有误\n");
printf("姓名:\n");
scanf("%s",banks[accountnum].name);
printf("密码:\n");
while((ch=getch())!='\r')
banks[accountnum].password[i++]=
putchar('*');
printf("\n");
printf("再次输入密码:\n");
while((ch=getch())!='\r')
password1[j++]=
putchar('*');
printf("\n");
r=strcmp(banks[accountnum].password,password1);
printf("两次密码不相同,开户失败!\n");
banks[accountnum].balance=0;
banks[accountnum].state=0;
accountnum++;
printf("开户成功\n");
void save()
if(load()!=1)
char addmoney[10];//存入金额
//将字符型转化为int型
printf("存入金额:\n");
scanf("%s",addmoney);
while(addmoney[i]!='\0')
if(addmoney[i]&'0'||addmoney[i]&'9')
printf("输入格式错误!\n");
while(addmoney[i]!='\0')
printf("金额超限\n");
money=atoi(addmoney);
if(money==0)
printf("存款失败\n");
banks[nowaccount].balance+=
printf("存款成功\n");
void withdraw()
if(load()!=1)
char reducemoney[10];//取款金额
int money,i=0;
printf("请输入取款金额\n");
scanf("%s",reducemoney);
while(reducemoney[i]!='\0')
if(reducemoney[i]&'0'||reducemoney[i]&'9')
printf("输入格式错误!\n");
while(reducemoney[i]!='\0')
printf("金额超限\n");
money=atoi(reducemoney);
if(money==0)
printf("取款失败\n");
if(money&banks[nowaccount].balance)
printf("您的账户没有这么多余额,取款失败!\n");
banks[nowaccount].balance-=
printf("取款成功\n");
void showAccount()
if(load()!=1&&load()!=2)
printf("您的账户信息如下:\n");
printf("账号:%s\t余额:%d\n",banks[nowaccount].account,banks[nowaccount].balance);
void transferAccounts()
if(load()!=1)
char account1[20];
int i,judge=0,money,a;
char tramoney[10];
printf("请输入您转入的账户\n");
scanf("%s",account1);
for(i=0; i& i++)
if(strcmp(account1,banks[i].account)==0)
if(judge!=1)
printf("没有发现此账户\n");
printf("请输入转账金额\n");
scanf("%s",tramoney);
while(tramoney[i]!='\0')
if(tramoney[i]&'0'||tramoney[i]&'9')
printf("输入格式错误!\n");
while(tramoney[i]!='\0')
printf("金额超限\n");
money=atoi(tramoney);
if(money==0)
printf("转账失败\n");
if(money&banks[nowaccount].balance)
printf("您的账户没有这么多余额,转账失败!\n");
banks[nowaccount].balance-=
banks[a].balance+=
printf("转账成功\n");
void reportLoss()
if(load()!=1)
banks[nowaccount].state=1;
printf("挂失成功\n");
void cancelLoss()
int judge=0;
if(load()==3)
printf("立即解挂请按1,退出请按0\n");
scanf("%d",&judge);
if(judge==1)
banks[nowaccount].state=0;
printf("解挂成功\n");
else if(load()==1)
printf("账户正常\n");
void cancelAccount()
printf("账户已经销户\n");
else if(r==3||r==0)
else if(r==1)
printf("请将您的账户余额取完\n");
banks[nowaccount].state=2;
banks[nowaccount].balance=0;
printf("注销成功\n");
void updatePassword()
char newpassword1[10]= {0},newpassword2[10]= {0};
int i=0,j=0,r;
if(load()!=1)
printf("请输入新密码\n");
while((ch=getch())!='\r')
newpassword1[i++]=
putchar('*');
printf("\n");
printf("再次输入密码:\n");
while((ch=getch())!='\r')
newpassword2[j++]=
putchar('*');
printf("\n");
r=strcmp(newpassword1,newpassword2);
printf("r:%d",r);
printf("两次密码不相同,改密失败!\n");
while(newpassword1[i]!='\0')
banks[nowaccount].password[i]=newpassword1[i];
printf("改密成功\n");
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具}

我要回帖

更多关于 c语言清零 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信