服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - C/C++ - C语言编程银行ATM存取款系统实现源码

C语言编程银行ATM存取款系统实现源码

2022-03-01 15:07菜鸟一号是我实锤 C/C++

这篇文章主要为大家介绍了C语言编程银行ATM存取款系统实现的源码示例,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步

这里使用的运行工具是dev c++。老铁们一定要看仔细了。是dev c++

仅供借鉴:这个是大一时期写的。大四的时候整理了一下(本人c语言学的也不太好)。肯定很多不足和存在漏洞的地方、仅供借鉴、仅供借鉴。

一、课程设计的目的

掌握c语言程序设计的基础知识、基本理论、原理和实现技术。

二、课程设计的题目

银行atm存取款系统

三、设计内容

(主要技术关键的分析、解决思路和方案比较等)

银行atm存取款系统

银行atm存取款系统业务描述如下:

银行atm存取款系统能为用户提供存款、取款、查询、转账和修改密码的功能。

为了模拟真实的atm业务环境,本系统必须实现存款、取款、查询、转账、修改密码以及开户的功能。

用户通过开户业务在本系统开立银行账户,之后可以通过该银行账户登陆atm系统,在系统中实现存款、取款、查询账户信息、修改密码的操作。

本系统各个业务有如下注意点:

(1)登陆系统
用户登陆之前,必须在登陆界面输入其银行账户,通过其正确输入的银行账户登陆系统。
(2)开户业务
要使用本系统必须首先执行开户业务开立新的银行账户,并且将此新开的银行存储于文件当中。同时,系统以身份证号码作为开户的充分条件,即一个身份证号码只能开立一次银行账户。
(3)存款业务
客户登陆系统后,选择存款业务,即可以将输入的存款金额存入相应的账户。
(4)取款业务
客户登陆系统后,选择取款业务,即可以将输入的取款金额从相应的银行账户取出,但是取款金额必须大于目前的账户余额。
(5)查询业务
客户登陆系统后,可以选择查询业务,查询账户余额。
(6)转账业务
客户登陆系统后,可以选择转账业务,进行转账。注意的是转账的目的账户必须是本系统已经存在的银行账户。
(7)修改密码
客户登陆系统后,可以选择修改密码业务,进行密码修改。

实现的效果

C语言编程银行ATM存取款系统实现源码

C语言编程银行ATM存取款系统实现源码

C语言编程银行ATM存取款系统实现源码

C语言编程银行ATM存取款系统实现源码

C语言编程银行ATM存取款系统实现源码

源码

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define n 1000
#include<conio.h>
struct chuhu{
    char idnum[9];//账户
    char name[10];//姓名
    char idnumber[20];//省份证号
   char password[7];//密码
   double cunkuan;//存款
}hu[n];
void date();//显示当前日期
int a,a1;//主界面选择变量
void flag1();//主界面
void flag2();//用户界面
void flag3();//用户功能选择界面
void zhuce();//注册
int yanzheng();//验证存单号或密码
//&&&&&&&&&&&&&&&&&&&&&&&
void qukaun();//取款
void cunkaun();//存款
void display();//查询
void zhuan();//转账
void xiugai();//密码修改
void display();//查找
//&&&&&&&&&&&&&&&&&&&&&&&&&&
 int a,key;//开户人数
 int i;//控制密码循环
 char ch='y';//是否继续注册
 double jin;//存的钱
 int t;
 char id[11],password[7];
int main(){
system("color 0a"); int b;
    flag1();//引入主界面
    do{
 
    printf("\n\n\t\t##请输入你的选择:");
    scanf("%d",&a);
    switch(a){
        case 1:{
            zhuce();//zhuce
            flag1();
            break;
        }
        case 2:{
            b=yanzheng();
            fflush(stdin);///好东西,以防跳过数据
            flag2();
            break;
        }
        case 3:exit(0);break;
        default:printf("\n\n\n\t\t您输入的数据不符合要求!!!\n\n\n\n\n");
        
    }
 
    }while(1);
}
void flag1(){
    printf("\n#################################################################################\n");
    printf("\n▓                          * 银行定期储蓄管理系统  *                           ▓\n");
    printf("\n#################################################################################\n");
    printf("\n          ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆\n");
    printf("          |◆|******|◆|                                     |◆|******|◆|\n");
    printf("          |◆|******|◆|       ☆ 开户业务    请按 1         |◆|******|◆|\n");
    printf("          |◆|******|◆|       ☆ 登录系统    请按 2         |◆|******|◆|\n");
    printf("          |◆|******|◆|       ☆ 退出        请按 3         |◆|******|◆|\n");
    printf("          |◆|******|◆|                                     |◆|******|◆|\n");
    printf("          ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆\n");
    printf("\n#################################################################################\n");   
}
//********************************************************************************************************************
//用户界面
void flag2(){
       int a,b;//选择功能的变量
       do{
        printf("\n\n按enter键进入、返回主菜单 " ) ;
        fflush(stdin);
        scanf("%c",&ch);
        system("cls");//清屏
           date();
    printf("\n#################################################################################\n");
    printf("\n▓                               * 欢迎使用  *                                 ▓\n");
    printf("\n#################################################################################\n");
    printf("\n          ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆\n");  
    printf("          |◆|******|◆|        ☆ 存款业务       请按 1        |◆|******|◆|\n");
    printf("          |◆|******|◆|        ☆ 取款业务       请按 2        |◆|******|◆|\n");
    printf("          |◆|******|◆|        ☆ 查询业务       请按 3        |◆|******|◆|\n");
    printf("          |◆|******|◆|        ☆ 转账业务       请按 4        |◆|******|◆|\n");
    printf("          |◆|******|◆|        ☆ 修改密码       请按 5        |◆|******|◆|\n");
    printf("          |◆|******|◆|        ☆ 退出系统       请按 6        |◆|******|◆|\n");
    printf("          |◆|******|◆|                                        |◆|******|◆|\n");
    printf("          ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆\n");
    printf("\n#################################################################################\n");
    printf("\n▓                          *******************************                    ▓\n");
    printf("\n#################################################################################\n");
    printf("\n\n\t\t##请输入你的选择:");
    fflush(stdin);
    scanf("%d",&a);
    switch(a){//注册
        case 1: { system("cls");fflush(stdin);cunkaun();break;//存款         
        }
        case 2:  {system("cls");fflush(stdin);qukaun();break;//取款  
        }
        case 3: {display();//查询业务
            break;
        }
        case 4:{system("cls");fflush(stdin);zhuan();break;//转账     
        }
        case 5: {system("cls");fflush(stdin);xiugai();break;//密码修改
                }
        case 6: exit(0);
        default:printf("您输入的选择有误,请输入正确的选项:");                                                           
    }
     } while(1);
}
//********************************************************************************************************************
//用户功能选择界面
void flag3(){
    printf("\n\n\t\t##请输入你的选择:");
    scanf("%d",&a1);
    switch(a1){
        case 1:printf("存款业务");break;
        case 2:printf("取款业务");break;
        case 3:printf("查询业务");break;
        case 4:printf("转账业务");break;
        case 5:printf("密码修改");break;
        case 6:printf("退出");break
    }
}
//********************************************************************************************************************
//开户
void zhuce(){
    file *nchuhu=fopen("chuh.txt","r");
    file *fchuhu=fopen("chuh.txt","a");
    int i;
    if((nchuhu=fopen("chuh.txt","r"))==null) printf("文件无,系统创建\n");
    do{
        system("cls");
    date();//显示当前日期
    printf("\n\n\t\t请输入新储户的信息:");
    fscanf(nchuhu,"%s\t%s\t%s\t%s\t%lf\n",&hu[a].idnum,&hu[a].name,&hu[a].idnumber,&hu[a].password,&hu[a].cunkuan);    
    printf("\n\n\t\t储户存单:");
    fflush(stdin);
    gets(hu[a].idnum);
    printf("\n\t\t姓名:");
    fflush(stdin);
    gets(hu[a].name);
    printf("\n\t\t储户密码(6位):");
    for(i=0;i<6;i++){
        fflush(stdin);
        hu[a].password[i]=getch();
        printf("*");
    //  scanf("%d",&hu[a].password[i]);
    }  
    do{
        printf("请输入省份证号码(18位):");
        fflush(stdin);
        gets(hu[a].idnumber);
        if(strlen(hu[a].idnumber)!=18)//strlen 代表的意思
        printf("\n\t\t输入错误!\n\t\t身份证请输入18位数字或者字母\n");
        for(i=0;i<a;i++)
        if(strcmp(hu[a].idnumber,hu[i].idnumber)==0&&strcmp(hu[a].name,hu[i].name)==0)
        break;     
        if(i<a)
          printf("\n\n\t\t前面已经有人用此身份证注册过\n\n\t\t请重新输入省份证号:\n");         
    }while((strlen(hu[a].idnumber)!=18)||(strcmp(hu[a].idnumber,hu[i].idnumber)==0)&&(strcmp(hu[a].name,hu[i].name)!=0) ); 
    printf("输入存储的金额:");
    fflush(stdin);
    scanf("%lf",&hu[a].cunkuan);   
    fprintf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[a].idnum,hu[a].name,hu[a].idnumber,hu[a].password,hu[a].cunkuan);
    a++;
    printf("是否继续是(y)/否(n)?");
    fflush(stdin);
    scanf("%c",&ch);
    }while(ch=='y'||ch=='y');
    printf("存入成功!");
//  system("pause");
    system("cls");
    fclose(nchuhu);
    fclose(fchuhu);
}
//********************************************************************************************************************
//验证存单号或密码
int yanzheng(){
    file *fchuhu=fopen("chuh.txt","r");
    int count=0;
    char id[9];
    for(i=0;i<=100;i++){
        fscanf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",&hu[i].idnum,&hu[i].name,&hu[i].idnumber,&hu[i].password,&hu[i].cunkuan);
    }
    do{
        system("cls");
                printf("\n\n\n\t\t$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
                printf("\t\t|#|                                                          |#|\n");
                printf("\t\t|#|                    ☆☆☆☆☆☆☆☆☆☆                  |#|\n");
                printf("\t\t|#|                    ☆                ☆                  |#|\n");
                printf("\t\t|#|             ☆   存单号或者密码有误自动返回   ☆         |#|\n");
                printf("\t\t|#|                    ☆                ☆                  |#|\n");
                printf("\t\t|#|                    ☆☆☆☆☆☆☆☆☆☆                  |#|\n");
                printf("\t\t|#|                                                          |#|\n");
                printf("\t\t$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
        printf("\n\n\n\t\t      请输入您的存单号:  ");
        scanf("%s",&id);
        printf("\n\n\n\t\t      请输入您的密码:  ");
        for(i=0;i<6;i++){
            fflush(stdin);
        password[i]=getch();
            printf("*");
        }
        password[6]='\0';
        fflush(stdin);
        scanf("c",&ch);
        printf("\n\n\t\t");
        for(i=0;i<99;i++){
            if(strcmp(id,hu[i].idnum)==0&&strcmp(password,hu[i].password)==0){
                fclose(fchuhu);
                return 0;
            }
        }      
    }while(count==0);
    fclose(fchuhu);
    return count;
}
//********************************************************************************************************************
//********************************************************************************************************************
//存款
void cunkaun(){
    file *fchuhu=fopen("chuh.txt","r");
    file *achuhu=fopen("back.txt","w");
    char id[9];int i;
    if(!fchuhu) printf("不能打开文件:");
    if(!achuhu) printf("不能创建文件");
    for(i=0;i<=100;i++){
    fscanf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",&hu[i].idnum,&hu[i].name,&hu[i].idnumber,&hu[i].password,&hu[i].cunkuan);
    }   //
    int x=0;
        date();
        printf("\n\n\t\t##请再次输入并确认存单:");
        scanf("%s",&id);
        for(i=0;i<=100;i++){
            if(strcmp(id,hu[i].idnum)==0){     
           printf("\n\n");
            printf("\t\t||================================================================||\n");
            printf("\t\t||                           *存款金额*                           ||\n");
            printf("\t\t||================================================================||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||         1、200        2、400        3、600        4、800       ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||         5、1000        6、2000        7、4000        8、6000   ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||================================================================||\n");
            printf("\t\t||================================================================||\n");
            printf("\n\n\t\t\t请输入你的取款金额:");
            scanf("%d",&a);
            switch(a){
                case 1:{jin=200;
                     printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^");
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 2:{jin=400;
                    printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^"); 
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 3:{
                    jin=600;
                     printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^"); 
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 4:{
                        jin=800;
                  printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^");
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                                case 5:{jin=1000;
                 printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^");
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 6:{jin=2000;
                 printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^");
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 7:{
                    jin=4000;
                  printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^");
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 8:{
                        jin=6000;
                     printf("\t\t\t存款%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^存款成功^^^^");
                    hu[i].cunkuan+=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 default:printf("\n\n\n\t\t\t您的选择金额不在服务范围内!!!\n\n\n\t\t\t请重新选择业务:");
                 
             }         
                fclose(fchuhu);
                fclose(achuhu);
                system("del chuh.txt");
                rename("back.txt","chuh.txt");//rename(旧的,新的)
                break;     
                }
                }
            }
//*******************************************************************************************************************
//取款
void qukaun(){
    file *fchuhu=fopen("chuh.txt","r");
    file *achuhu=fopen("back.txt","w");
    int i;
    char id[9];
    if(!fchuhu) printf("不能打开文件:");
    if(!achuhu) printf("不能创建新文件:");
    for(i=0;i<=100;i++){
    fscanf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",&hu[i].idnum,&hu[i].name,&hu[i].idnumber,&hu[i].password,&hu[i].cunkuan);
    }
        date();
        printf("\n\n\t\t请再次输入并确认存单:");
        scanf("%s",&id);
        for(i=0;i<=99;i++){
            if(strcmp(id,hu[i].idnum)==0){
            printf("\n\n");
            printf("\t\t||================================================================||\n");
            printf("\t\t||                           *取款金额*                           ||\n");
            printf("\t\t||================================================================||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||         1、200        2、400        3、600        4、800       ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||         5、1000        6、2000        7、4000        8、6000   ||\n");
            printf("\t\t||                                                                ||\n");
            printf("\t\t||================================================================||\n");
            printf("\t\t||================================================================||\n");
            printf("\n\n\t\t\t请输入你的取款金额:");
            scanf("%d",&a);
            switch(a){
                case 1:{jin=200;
                    printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^");
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 2:{jin=400;
                    printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^");
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 3:{
                    jin=600;
                 printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^"); 
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 4:{
                        jin=800;
                 printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^");
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                                case 5:{jin=1000;
                    printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^");
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 6:{jin=2000;
                printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^");
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 7:{
                    jin=4000;
                 printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^");
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 case 8:{
                        jin=6000;
                 printf("\t\t\t取出%lf元",jin);
                    printf("\n\n\n\t\t\t^^^^取款成功^^^^");
                    hu[i].cunkuan-=jin;
                    printf("\n\n\t\t\t$您的余额为:%lf",hu[i].cunkuan);
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                    break;
                 }
                 default:printf("\n\n\n\t\t\t您的选择金额不在服务范围内!!!\n\n\n\t\t\t请重新选择业务:");                
             }
                fclose(fchuhu);
                fclose(achuhu);
                system("del chuh.txt");
                rename("back.txt","chuh.txt");
                break;
             }
         }
}
//********************************************************************************************************************
//转账
void zhuan(){
    file *fchuhu=fopen("chuh.txt","r+");
    int i;
    char id[9];
    if(!fchuhu) printf("不能打开文件:");
 
    for(i=0;i<=100;i++){
    fscanf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",&hu[i].idnum,&hu[i].name,&hu[i].idnumber,&hu[i].password,&hu[i].cunkuan);
    }
        date();
        printf("\n\n\t\t请输入转账人的存单号:");
        scanf("%s",&id);
        for(i=0;i<=99;i++){
            if(strcmp(id,hu[i].idnum)==0){
              printf("\n\n\t\t请输入要转账的金额:");
               scanf("%lf",&jin);
               printf("\n\n\t\t请确认数目:%lf",jin);
                 hu[i].cunkuan+=jin;
                 printf("\n\n\n转账成功");
                    fprintf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[a].idnum,hu[a].name,hu[a].idnumber,hu[a].password,hu[a].cunkuan);
                        fclose(fchuhu);
    fclose(fchuhu);
                 break;
             }
         
}
//********************************************************************************************************************
//********************************************************************************************************************
void xiugai(){
    file *fchuhu=fopen("chuh.txt","r");
    file *achuhu=fopen("back.txt","w");
    int j,i;
    char id[9];
    if(!fchuhu) printf("不能打开文件:");
    if(!achuhu) printf("不能创建新文件:");
    for(i=0;i<=100;i++){
    fscanf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",&hu[i].idnum,&hu[i].name,&hu[i].idnumber,&hu[i].password,&hu[i].cunkuan);
    }
        date();
        printf("\n\n\t\t请再次输入并确认存单:");
        scanf("%s",&id);
        for(i=0;i<=99;i++){
            if(strcmp(id,hu[i].idnum)==0){
            printf("请输入新的密码:\n");
                printf("\n\t\t储户密码(6位):");
    for(j=0;j<6;j++){
        fflush(stdin);
        hu[i].password[j]=getch();
        printf("*");
 
    }
                 printf("\n\n\t\t新的密码:%s\n",hu[i].password);            
                 printf("\n\n\t\t修改成功");
                    fprintf(achuhu,"%s\t%s\t%s\t%s\t%lf\n",hu[a].idnum,hu[a].name,hu[a].idnumber,hu[a].password,hu[a].cunkuan);
                        fclose(fchuhu);
    fclose(achuhu);
    system("del chuh.txt");
    rename("back.txt","chuh.txt");
                 break;
             }
         }
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//查询信息
void display(){
    file *fchuhu=fopen("chuh.txt","r");
    int i,n=0;
    char fnumb[9];
    system("cls");
    for(i=0;i<=100;i++){
            fscanf(fchuhu,"%s\t%s\t%s\t%s\t%lf\n",&hu[i].idnum,&hu[i].name,&hu[i].idnumber,&hu[i].password,&hu[i].cunkuan);
    }  
    printf("\n\n●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n");
    printf("\n\n              ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●                      \n");
    printf("\n\n                              ●●●●●●●●●●●●●●●●●●●●●●●●●●                                              \n");
    printf("\n\n\n\t\t\t\t\t请输入你的存单号:");
    scanf("%s",&fnumb);
    printf("\n\n\n");
    printf("\t\t\t\t\t您的个人信息如下:");
    printf("\n\n");
    for(i=0;i<=99;i++)
        if(strcmp(fnumb,hu[i].idnum)==0){
                printf("存单号:%s\t姓名:%s\t身份证:%s\t密码:%s\t存款金额:%lf\n",hu[i].idnum,hu[i].name,hu[i].idnumber,hu[i].password,hu[i].cunkuan);
                n=1;
                fclose(fchuhu);
                system("pause");
                break;
        }
if(n==0) printf("此账单不存在!!!\n");
fclose(fchuhu);
 
}
//********************************************************************************************************************
void date(){//显示当前日期
printf("当前日期:");
system("date/t");
printf("当前时间:");
system("time/t");
    
}

业务流程

1、用户开户

C语言编程银行ATM存取款系统实现源码

2、登录流程

C语言编程银行ATM存取款系统实现源码

3、密码修改

C语言编程银行ATM存取款系统实现源码

以上就是c语言编程银行atm存取款系统实现源码的详细内容,更多关于c语言实现银行atm存取款系统的资料请关注服务器之家其它相关文章!

原文链接:https://blog.csdn.net/weixin_43304253/article/details/121459743

延伸 · 阅读

精彩推荐