当前位置:   article > 正文

C语言实现银行ATM存取款系统 | 附源码

c语言银行atm存取款机系统

点击蓝字

359c760fc9a47567448e015562a20d07.png

关注我们

来源于网络,侵删

银行ATM存取款系统

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

银行ATM存取款系统能为用户提供存款、取款、查询、转账和修改密码的功能。为了模拟真实的ATM业务环境,本系统必须实现存款、取款、查询、转账、修改密码以及开户的功能。用户通过开户业务在本系统开立银行账户,之后可以通过该银行账户登陆ATM系统,在系统中实现存款、取款、查询账户信息、修改密码的操作。本系统各个业务有如下注意点:

  • (1)登陆系统

用户登陆之前,必须在登陆界面输入其银行账户,通过其正确输入的银行账户登陆系统。

  • (2)开户业务

要使用本系统必须首先执行开户业务开立新的银行账户,并且将此新开的银行存储于文件当中。同时,系统以身份证号码作为开户的充分条件,即一个身份证号码只能开立一次银行账户。

  • (3)存款业务

客户登陆系统后,选择存款业务,即可以将输入的存款金额存入相应的账户。

  • (4)取款业务

客户登陆系统后,选择取款业务,即可以将输入的取款金额从相应的银行账户取出,但是取款金额必须大于目前的账户余额。

  • (5)查询业务

客户登陆系统后,可以选择查询业务,查询账户余额。

  • (6)转账业务

客户登陆系统后,可以选择转账业务,进行转账。注意的是转账的目的账户必须是本系统已经存在的银行账户。

  • (7)修改密码

客户登陆系统后,可以选择修改密码业务,进行密码修改。

实现的效果

657949e7c6657cf14896599907b08f9c.png
image
58ee555c566eefe41326c0cbf28b3da2.png
image
a1a778162715b2eeb2467a01065edd7b.png
image
1d5f3d281908d607624c49618267e046.png
image
33226aa586f4b919e03703ef51c2da47.png
image

源码

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

业务流程

1、用户开户c43b2f66a38fb58e2d6e5a857ccbbb3e.png

2、登录流程0eddbaf86af86178c4a0e6d3b4917c8e.png

3、密码修改f2f53a169134c8d43e15c31d1f7be6a1.png

 
 
 
 

1331cb9047743f1002eaa62c283b1a89.gif

如果你年满18周岁以上,又觉得学【C语言】太难?想尝试其他编程语言,那么我推荐你学Python,现有价值499元Python零基础课程限时免费领取,限10个名额!
▲扫描二维码-免费领取

bde99b63c568e9ca3636329bcb954fd6.gif

戳“阅读原文”我们一起进步

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/355833?site
推荐阅读
相关标签
  

闽ICP备14008679号