c語言銀行系統
『壹』 麻煩給個用c語言銀行系統啊!!
微軟的Visual C++ 2008 速成免費版,非企業用戶可以免費使用
官方下載地址:
用VC 2008編寫C程序的步驟見:
本人正在用,感覺不錯.我的操作系統,vista home basic!
『貳』 c語言銀行程序
|#include<math.h>
#include<stdio.h>
main(){
int a,c,d,e;
float b=10000;
int f;
int num=1;
printf("\t\t\t CHNIA BANK ATM\nplease input your secret code:\n");
scanf("%d",&a);
if(a==num){
printf(" welcome you to use your count,you have %.2f RMB!\n",b);
printf(" how much money do you want? please input the numbers: ");
scanf("%d",&e);
printf("\n");
c=b-e;
printf(" you till have : %d ,please choose exit or choose function ! \n",c);
scanf("%c",&d);
printf("\n");
}
else if(a!=num){
printf("your secret code is wrong,please input the correct secret code!\n");
}
printf("\t\t \tHELLO,WELCOME TO USE ATM\nplease choose you want function\n");
printf("\n\n");
printf("\t\t-----------------------------------\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t| 1. check\t| 2. withdraw money\t |\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t-----------------------------------\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t| 3. transfer account\t| 4. midify secret code|\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t-----------------------------------\n");
printf("\t\t|\t\t\t\t |\n");
printf("\t\t|\t 0. exit \t\t |\n");
printf("\t\t|\t\t\t\t |\n");
printf("\t\t-----------------------------------\n");
printf("please choose function:\n ");
scanf("%d",&f);
switch(f)
{ case 0:printf("exit");break;
case 1:printf("check");break;
case 2:printf("withdraw money");break;
case 3:printf("transfer account");break;
case 4:printf("midify secret code");break;
default :printf("it's wrong,please choose in 0~4!");
}
getch();
}
『叄』 用C語言編寫銀行帳戶賬戶管理系統
使用 C 語言編寫一個銀行帳戶管理系統?你的這個編程要求實在是太高了,肯定是不會有人滿足你的要求的。
因為這個要求已經不是簡單地答疑 C 語言的語法錯誤之類的問題了,而是需要從頭設計整個該帳戶管理系統的各種數據存儲結構、以及各種演算法(在編寫此軟體的過程中,肯定需要涉及:到底採用哪一種排序演算法效率最高、以及採取哪一種查找演算法對人員進行查詢效率最高),並且要想徹底從編寫一個源程序,到編譯、鏈接、直到該應用軟體能夠運行出用戶所要求的最終正確結果,那是需要花費很多的時間和精力去調試的,而不是只要寫出程序代碼,即使程序的編程思路是正確的,也不一定能夠保證程序的運行結果是正確的。
『肆』 c語言 銀行取款管理系統
『伍』 怎樣用C語言編寫模擬銀行系統
DOS下的?
『陸』 C語言銀行管理系統,跪求,跪求
C語言期末測試題(開卷) 設計一個銀行賬戶管理程序 , 賬戶的信息有賬戶唯-)、 姓名、余額專、身份證屬號碼、單位、電話號碼、 地址等,允許用戶進行如下操作:開戶、銷戶、存款、取款、轉賬、查詢。基本要求: 程序運行時,可以由用戶選擇進行何種操作,開戶操作要求輸入用戶信息後自動獲取賬號,用戶銷戶後賬號被回收,並且該賬號可以繼續分配給其它賬戶,不允許用戶送支,根據姓名或賬號可以進行用戶的信息查詢,所有的賬號信息可存放一個數組中或者鏈表中,可以隨時訪問和更新,測試數據 程序應輸入不少於5人的賬戶信息, 應考慮到人員同名的情況。實現提示: 可以定義一個數組或者鏈表來存候賬戶的信息。實現開戶、銷戶、存款、職款、轉賬、查詢等函數
『柒』 C語言 銀行存儲模擬系統
// t.cpp : Defines the entry point for the console application.//#include "stdafx.h"int Card[100][5+3];void main(){ for(int i=0;i<100;i++) { Card[i][0]=i; Card[i][1]=0; ]==nCahao) { nT=1; nPose=i; break; } } printf("卡號不正確"); } printf("你的存款余額為%d\n",Card[nPose][1]); while(1) { printf("1,取款 2, 存款\n"); int nSelect; scanf("%d",&nSelect); switch(nSelect) { case 1: printf("請輸入提款金額\n"); int nJine; scanf("%d",&nJine); Card[nCahao][Card[nCahao][2]]=-nJine; Card[nCahao][2]=Card[nCahao][2]++; printf("你的取款額為%d請在出鈔口領現金\n",nJine); nJine); printf("請取卡\n"); return; } } }
『捌』 C語言銀行管理系統
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
char cFile[] = "date.txt";
struct bank
{
char id[10+1];
char psw[6+1];
double money;
};
welcome1()
{
printf("\n\n\t\t歡迎使用虛擬銀行自動取款機服務!\t\t\n\n");
printf("請選擇功能:\n");
printf("\n=================================================\n");
printf(" || 請輸入序號 ||\n");
printf(" || 1.新用戶開戶。 ||\n");
printf(" || 2.老用戶登陸。 ||\n");
printf(" || 3.退出系統。 ||\n");
printf("=================================================\n");
}
welcome2()
{
printf("\n\n\t\t注冊須知\n\n");
printf("**************************************************\n");
printf("* 1.請填寫您的真實資料! *\n");
printf("* 2.開戶首期必須存入100元以上 *\n");
printf("**************************************************\n");
}
welcome3()
{
printf("\n\n\t\t\3 歡迎進入虛擬銀行系統 \3\n\n");
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n");
printf("\1\1\t 請選擇功能:1.取款(最多透資2000); \1\1\n");
printf("\1\1\t 2.存款; \1\1\n");
printf("\1\1\t 3.查詢余額; \1\1\n");
printf("\1\1\t 4.修改密碼; \1\1\n");
printf("\1\1\t 5.返回主頁面; \1\1\n");
printf("\1\1\t 任意鍵退出. \1\1\n");
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n");
}
int search(char* user, char* pwd, char* real_pwd)/*判斷帳號是否相同,不相同返回1*/
{
FILE* file;
char user_buff[256], pwd_buff[256];
file = fopen(cFile, "r");
if (!file) return 0;
while (!feof(file))
{
if (fscanf(file, "%s%s\n", user_buff, pwd_buff) == EOF) return 0;
if (!strcmp(user_buff, user))
{
if (real_pwd) strcpy(real_pwd, pwd_buff);
return 1;
}
}
fclose(file);
return 0;
}
int add(char* user, char* pwd, double coin_n)
{
FILE* file;
file = fopen(cFile, "a");
if (!file) return 0;
fprintf(file, "%s %s %.2lf\n", user, pwd, coin_n);
fclose(file);
return 0;
}
int wenjian(char* user, char* pwd,double coin)
{
if (search(user, pwd, NULL)) return 0;
else add(user, pwd, coin);
return 1;
}
zhuce()/*注冊*/
{
struct bank *p;
int i=0,k=0,judge1,judge2;
char name[30];
char sex,ch;
char sh[18];
int n;
p=(struct bank*)malloc(sizeof(struct bank));/*給p分配內存*/
welcome2();
printf("請輸入您的名字(純英文):");
gets(name);
printf("請輸入您的性別(男:1 女2):");
fflush(stdin);
scanf("%c",&sex);
fflush(stdin);
printf("請輸入您的身份證號碼:");
gets(sh);
for(n=0;n<strlen(name);n++)/*判斷輸入信息是否正確*/
{
if(name[n]>='0'&&name[n]<='9')
{
printf("您輸入的名字有誤!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
if(sex!='1'&&sex!='2')/*判斷輸入信息是否正確*/
{
printf("您輸入的性別不對!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
if(strlen(sh)!=18)/*判斷輸入信息是否正確*/
{
printf("您輸入的身份證號碼不全!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
for(n=0;n<strlen(sh)-1;n++)/*判斷輸入信息是否正確*/
{
if(sh[n]<48||sh[n]>57)
{
printf("您輸入的身份證號碼非法!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
else
{
if(sh[18]!='x'&&sh[18]<48&&sh[18]>57)
{
printf("您輸入的身份證號碼非法!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
}
printf("請輸入您的帳號(10位純數字):\n");
fflush(stdin);
scanf("%s",p->id);
fflush(stdin);
while(i <strlen(p->id))
{
if((p->id[i] < 48) || (p->id[i] > 57))
{
judge1=0;
}
i++;
}
while(strlen(p->id)!=10 ||judge1==0)/*判斷帳號的正確性*/
{
printf("您輸入的帳號不正確,必須為10位純數字!");
printf("請重新輸入(10位純數字):");
fflush(stdin);
scanf("%s",p->id);
fflush(stdin);
}
printf("請輸入您的密碼(6位純數字):\n");
fflush(stdin);
scanf("%s",p->psw);
fflush(stdin);
while(k <strlen(p->psw))
{
if((p->psw[k] < 48) || (p->psw[k] > 57))
{
judge2=0;
}
k++;
}
while(strlen(p->psw)!=6 ||judge2==0)/*判斷密碼形式的正確性*/
{
printf("您輸入不正確!密碼必須為6位純數字!\n");
printf("請重新輸入密碼(6位純數字):");
fflush(stdin);
scanf("%s",p->psw);
fflush(stdin);
}
printf("請輸入您的首期存款:");
fflush(stdin);
scanf("%lf",&p->money);
fflush(stdin);
while((p->money)<100)
{
printf("您必須存入100元以上,請重新輸入:");
fflush(stdin);
scanf("%lf",&p->money);
fflush(stdin);
}
if (wenjian(p->id,p->psw,p->money))/*存入文件並輸出基本信息*/
{
system("cls");
printf("注冊成功!");
printf("您的注冊信息如下,請牢記:\n");
printf("名字:");
puts(name);
printf("性別代碼:%c\n",sex);
printf("身份證號碼:");
puts(sh);
printf("帳號:");
puts(p->id);
printf("密碼:");
puts(p->psw);
printf("您帳戶里的余額為:%.2lf\n",p->money);
printf("請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
else/*如有相同帳號,注冊失敗*/
{
system("cls");
printf("您輸入的帳號已經存在!注冊失敗!\n");
printf("請選擇:按1返回主頁面. 按任意鍵退出:");
scanf("%c",&ch);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
gongneng(char Account[10+1],char Password[6+1],double Money)/*登陸成功後的功能界面*/
{
FILE *ps;
struct bank xin[1000];
int k=0,b=0;
char mima[6+1],Chiose,x;
char count[10+1],word[6+1];
double inmoney,outmoney,addmoney;
welcome3();
fflush(stdin);
scanf("%c",&Chiose);
fflush(stdin);
ps=fopen(cFile,"r");
if (!ps)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&x);
fflush(stdin);
exit(0);
}
if(Chiose=='1')
{
printf("輸入您的取款金額:");
fflush(stdin);
scanf("%lf",&outmoney);
fflush(stdin);
while(!feof(ps))
{
fscanf(ps, "%s %s %lf",&xin[k].id,&xin[k].psw,&xin[k].money);
k++;
}
fclose(ps);
ps=fopen(cFile,"wb");
if (!ps)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&x);
fflush(stdin);
exit(0);
}
while(!feof(ps))
{
//printf("%s %s %.2lf\n",xin[b].id,xin[b].psw,xin[b].money);
if ((strcmp(Account, xin[b].id)==0)&&(strcmp(Password, xin[b].psw)==0))
{
xin[b].money=xin[b].money-outmoney;
}
printf("%.2lf\n",xin[b].money);
fprintf(ps, "%s %s %.2lf\n", xin[b].id, xin[b].psw, xin[b].money);
b++;
}
}
}
denglu()/*登陸*/
{
FILE *fp;
char account[10+ 1],password[6 + 1],h;
int m=0;
char real_account[10+ 1]; /* 帳號緩存 */
char real_password[6 + 1]; /* 密碼緩存*/
double real_money_o=0.0; /*存款緩存*/
printf("請輸入您的帳號(10位純數字):");
gets(account);
printf("請輸入您的密碼(6位純數字):");
gets(password);
fp = fopen(cFile, "r");
if (!fp)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&h);
fflush(stdin);
exit(0);
}
while (m<=2) /*判斷是否輸入錯3次了*/
{
while(fscanf(fp, "%s %s %lf", &real_account, &real_password,&real_money_o) != EOF) /*循環判斷帳號密碼*/
{
if ((strcmp(real_account, account)==0)&&(strcmp(real_password, password)==0))
{
system("cls");
printf("登陸成功!");
gongneng(real_account,real_password,real_money_o);
fclose(fp);
return 0;
}
}
rewind(fp); /*重新打開文件,進行新一輪的密碼驗證*/
printf("您輸入的帳號不存在或密碼不正確!\n請重新輸入:\n");
m++;
printf("請輸入您的帳號(10位純數字):");
fflush(stdin);
gets(account);
fflush(stdin);
printf("請輸入您的密碼(6位純數字):");
fflush(stdin);
gets(password);
fflush(stdin);
}
fclose(fp);
printf("您輸入帳號密碼不正確已經3次,您被強制退出系統(按任意鍵退出)!");
fflush(stdin);
scanf("%c",&h);
fflush(stdin);
exit(0);
}
int main()
{
char chiose;
welcome1();
scanf("%c",&chiose);
getchar();
if(chiose <='0' ||chiose>='4')
{
while(chiose <='0' || chiose>='4')
{
printf("您的輸入有誤,請重新輸入:");
scanf("%c",&chiose);
getchar();
}
}
if(chiose=='1')
{
system("cls");
zhuce();/*注冊*/
}
if(chiose=='2')
{
system("cls");
denglu();/*登陸*/
}
if(chiose=='3')
{
printf("謝謝您的使用!");
exit(0);
}
}
打字不易,如滿意,望點贊。
『玖』 c語言 銀行賬戶信息管理系統
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
char cFile[] = "date.txt";
struct bank
{
char id[10+1];
char psw[6+1];
double money;
};
welcome1()
{
printf("\n\n\t\t歡迎使用虛擬銀行自動取款機服務!\t\t\n\n");
printf("請選擇功能:\n");
printf("\n=================================================\n");
printf(" || 請輸入序號 ||\n");
printf(" || 1.新用戶開戶。 ||\n");
printf(" || 2.老用戶登陸。 ||\n");
printf(" || 3.退出系統。 ||\n");
printf("=================================================\n");
}
welcome2()
{
printf("\n\n\t\t注冊須知\n\n");
printf("**************************************************\n");
printf("* 1.請填寫您的真實資料! *\n");
printf("* 2.開戶首期必須存入100元以上 *\n");
printf("**************************************************\n");
}
welcome3()
{
printf("\n\n\t\t\3 歡迎進入虛擬銀行系統 \3\n\n");
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n");
printf("\1\1\t 請選擇功能:1.取款(最多透資2000); \1\1\n");
printf("\1\1\t 2.存款; \1\1\n");
printf("\1\1\t 3.查詢余額; \1\1\n");
printf("\1\1\t 4.修改密碼; \1\1\n");
printf("\1\1\t 5.返回主頁面; \1\1\n");
printf("\1\1\t 任意鍵退出. \1\1\n");
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n");
}
int search(char* user, char* pwd, char* real_pwd)/*判斷帳號是否相同,不相同返回1*/
{
FILE* file;
char user_buff[256], pwd_buff[256];
file = fopen(cFile, "r");
if (!file) return 0;
while (!feof(file))
{
if (fscanf(file, "%s%s\n", user_buff, pwd_buff) == EOF) return 0;
if (!strcmp(user_buff, user))
{
if (real_pwd) strcpy(real_pwd, pwd_buff);
return 1;
}
}
fclose(file);
return 0;
}
int add(char* user, char* pwd, double coin_n)
{
FILE* file;
file = fopen(cFile, "a");
if (!file) return 0;
fprintf(file, "%s %s %.2lf\n", user, pwd, coin_n);
fclose(file);
return 0;
}
int wenjian(char* user, char* pwd,double coin)
{
if (search(user, pwd, NULL)) return 0;
else add(user, pwd, coin);
return 1;
}
zhuce()/*注冊*/
{
struct bank *p;
int i=0,k=0,judge1,judge2;
char name[30];
char sex,ch;
char sh[18];
int n;
p=(struct bank*)malloc(sizeof(struct bank));/*給p分配內存*/
welcome2();
printf("請輸入您的名字(純英文):");
gets(name);
printf("請輸入您的性別(男:1 女2):");
fflush(stdin);
scanf("%c",&sex);
fflush(stdin);
printf("請輸入您的身份證號碼:");
gets(sh);
for(n=0;n<strlen(name);n++)/*判斷輸入信息是否正確*/
{
if(name[n]>='0'&&name[n]<='9')
{
printf("您輸入的名字有誤!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
if(sex!='1'&&sex!='2')/*判斷輸入信息是否正確*/
{
printf("您輸入的性別不對!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
if(strlen(sh)!=18)/*判斷輸入信息是否正確*/
{
printf("您輸入的身份證號碼不全!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
for(n=0;n<strlen(sh)-1;n++)/*判斷輸入信息是否正確*/
{
if(sh[n]<48||sh[n]>57)
{
printf("您輸入的身份證號碼非法!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
else
{
if(sh[18]!='x'&&sh[18]<48&&sh[18]>57)
{
printf("您輸入的身份證號碼非法!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
}
printf("請輸入您的帳號(10位純數字):\n");
fflush(stdin);
scanf("%s",p->id);
fflush(stdin);
while(i <strlen(p->id))
{
if((p->id[i] < 48) || (p->id[i] > 57))
{
judge1=0;
}
i++;
}
while(strlen(p->id)!=10 ||judge1==0)/*判斷帳號的正確性*/
{
printf("您輸入的帳號不正確,必須為10位純數字!");
printf("請重新輸入(10位純數字):");
fflush(stdin);
scanf("%s",p->id);
fflush(stdin);
}
printf("請輸入您的密碼(6位純數字):\n");
fflush(stdin);
scanf("%s",p->psw);
fflush(stdin);
while(k <strlen(p->psw))
{
if((p->psw[k] < 48) || (p->psw[k] > 57))
{
judge2=0;
}
k++;
}
while(strlen(p->psw)!=6 ||judge2==0)/*判斷密碼形式的正確性*/
{
printf("您輸入不正確!密碼必須為6位純數字!\n");
printf("請重新輸入密碼(6位純數字):");
fflush(stdin);
scanf("%s",p->psw);
fflush(stdin);
}
printf("請輸入您的首期存款:");
fflush(stdin);
scanf("%lf",&p->money);
fflush(stdin);
while((p->money)<100)
{
printf("您必須存入100元以上,請重新輸入:");
fflush(stdin);
scanf("%lf",&p->money);
fflush(stdin);
}
if (wenjian(p->id,p->psw,p->money))/*存入文件並輸出基本信息*/
{
system("cls");
printf("注冊成功!");
printf("您的注冊信息如下,請牢記:\n");
printf("名字:");
puts(name);
printf("性別代碼:%c\n",sex);
printf("身份證號碼:");
puts(sh);
printf("帳號:");
puts(p->id);
printf("密碼:");
puts(p->psw);
printf("您帳戶里的余額為:%.2lf\n",p->money);
printf("請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
else/*如有相同帳號,注冊失敗*/
{
system("cls");
printf("您輸入的帳號已經存在!注冊失敗!\n");
printf("請選擇:按1返回主頁面. 按任意鍵退出:");
scanf("%c",&ch);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
gongneng(char Account[10+1],char Password[6+1],double Money)/*登陸成功後的功能界面*/
{
FILE *ps;
struct bank xin[1000];
int k=0,b=0;
char mima[6+1],Chiose,x;
char count[10+1],word[6+1];
double inmoney,outmoney,addmoney;
welcome3();
fflush(stdin);
scanf("%c",&Chiose);
fflush(stdin);
ps=fopen(cFile,"r");
if (!ps)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&x);
fflush(stdin);
exit(0);
}
if(Chiose=='1')
{
printf("輸入您的取款金額:");
fflush(stdin);
scanf("%lf",&outmoney);
fflush(stdin);
while(!feof(ps))
{
fscanf(ps, "%s %s %lf",&xin[k].id,&xin[k].psw,&xin[k].money);
k++;
}
fclose(ps);
ps=fopen(cFile,"wb");
if (!ps)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&x);
fflush(stdin);
exit(0);
}
while(!feof(ps))
{
//printf("%s %s %.2lf\n",xin[b].id,xin[b].psw,xin[b].money);
if ((strcmp(Account, xin[b].id)==0)&&(strcmp(Password, xin[b].psw)==0))
{
xin[b].money=xin[b].money-outmoney;
}
printf("%.2lf\n",xin[b].money);
fprintf(ps, "%s %s %.2lf\n", xin[b].id, xin[b].psw, xin[b].money);
b++;
}
}
}
denglu()/*登陸*/
{
FILE *fp;
char account[10+ 1],password[6 + 1],h;
int m=0;
char real_account[10+ 1]; /* 帳號緩存 */
char real_password[6 + 1]; /* 密碼緩存*/
double real_money_o=0.0; /*存款緩存*/
printf("請輸入您的帳號(10位純數字):");
gets(account);
printf("請輸入您的密碼(6位純數字):");
gets(password);
fp = fopen(cFile, "r");
if (!fp)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&h);
fflush(stdin);
exit(0);
}
while (m<=2) /*判斷是否輸入錯3次了*/
{
while(fscanf(fp, "%s %s %lf", &real_account, &real_password,&real_money_o) != EOF) /*循環判斷帳號密碼*/
{
if ((strcmp(real_account, account)==0)&&(strcmp(real_password, password)==0))
{
system("cls");
printf("登陸成功!");
gongneng(real_account,real_password,real_money_o);
fclose(fp);
return 0;
}
}
rewind(fp); /*重新打開文件,進行新一輪的密碼驗證*/
printf("您輸入的帳號不存在或密碼不正確!\n請重新輸入:\n");
m++;
printf("請輸入您的帳號(10位純數字):");
fflush(stdin);
gets(account);
fflush(stdin);
printf("請輸入您的密碼(6位純數字):");
fflush(stdin);
gets(password);
fflush(stdin);
}
fclose(fp);
printf("您輸入帳號密碼不正確已經3次,您被強制退出系統(按任意鍵退出)!");
fflush(stdin);
scanf("%c",&h);
fflush(stdin);
exit(0);
}
int main()
{
char chiose;
welcome1();
scanf("%c",&chiose);
getchar();
if(chiose <='0' ||chiose>='4')
{
while(chiose <='0' || chiose>='4')
{
printf("您的輸入有誤,請重新輸入:");
scanf("%c",&chiose);
getchar();
}
}
if(chiose=='1')
{
system("cls");
zhuce();/*注冊*/
}
if(chiose=='2')
{
system("cls");
denglu();/*登陸*/
}
if(chiose=='3')
{
printf("謝謝您的使用!");
exit(0);
}
}