簡易銀行管理系統(tǒng)C++版_第1頁
簡易銀行管理系統(tǒng)C++版_第2頁
簡易銀行管理系統(tǒng)C++版_第3頁
簡易銀行管理系統(tǒng)C++版_第4頁
簡易銀行管理系統(tǒng)C++版_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)專心-專注-專業(yè)精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)#include#include #include #include#includeusing namespace std;struct Clientchar name20; /姓名char ID_num20; /身份證號碼 char account20; /賬號char password20; /密碼char address20; /住址char type20; /存款類型double money; /金額bool IsLost; bool IsLock;Client

2、 * link;Client(Client * ptr=NULL)link=ptr;Client(char n,char i,char a,char p,char q,char t,double m,Client * ptr=NULL) /構(gòu)造函strcpy_s(name,n);strcpy_s(ID_num,i);strcpy_s(account,a);strcpy_s(password,p);strcpy_s(address,q);strcpy_s(type,t); money=m;link=ptr;void Deposit() /存款 double m;coutnntt請輸入存款金額:b

3、bbbbbbbbbb;cinm;money=money+m;coutnntt*存 款 成 功 !*;coutnntt*;coutnnnn; coutttn; coutendl; coutttn; couttt| 姓名: |nameendl; couttt| 賬號: |accountendl; couttt| 本次存款: |mendl; couttt| 可用余額: |moneyendl; coutendl;void Withdrawals() /取款double m;while(1)coutnntt請輸入取款金額:bbbbbbbbbbb;cinm;if(m0)if(moneym)coutnntt

4、*對不起,您的余額不足*endl; elsemoney=money-m;coutnntt*交 易 成 功*;coutnntt*; coutnnnn; coutttn; coutendl; coutttn; couttt| 姓名: nameendl; couttt| 賬號: accountendl; couttt| 本次取款: mendl; couttt| 可用余額: moneyendl;coutendl;break;else coutnntt*你輸入的金額有誤,請輸入數(shù)值大于0的金額數(shù)!*endl;void ChangPassword() /修改密碼char newPassword120,ne

5、wPassword220;for(int i=0;i20;i+)newPassword1i=0;newPassword2i=0;while(1)coutnntt請輸入新密碼:bbbbbbbbbbbbbbbbbbbb;cinnewPassword1;coutendl;coutnntt請再次輸入密碼:bbbbbbbbbbbbbbbbbbbb;cinnewPassword2;if(strcmp(newPassword1,newPassword2)=0)strcpy_s(password,newPassword1);coutnntt*密碼修改成功!*endl;break;coutendl;coutnn

6、tt*兩次輸入的密碼不一致,請重新輸入!*;/* *打印分割行 */void printSeperatorLine(int FIELD_NUM,int FIELD_WIDTH)coutn;cout|;/FIELD_NUM定義為全局只讀變量,表示用戶信息域的數(shù)量,這里只有姓名,ID,賬號,余額,存款類型,住址 所以是6/FIELD_WIDTH定義為只讀全局變量,用來控制輸出顯示表格中提供給每個域的寬度,這個可以根據(jù)自己顯示器的寬度進(jìn)行適當(dāng)調(diào)整for(int k = 0; k FIELD_NUM; +k)for(int i = 0; i FIELD_WIDTH; +i)cout-;cout|;co

7、utendl;void printHeadLine(int FIELD_WIDTH)cout|;/設(shè)置輸出“姓名”長度為18,不夠18個字符則用空格字符填補(bǔ),設(shè)置為靠左對齊(沒有居中對齊),如果超過18個字符,那么會被截斷為18個字符coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)姓名|;coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)ID|;coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)賬號|;coutsetw(FIELD_

8、WIDTH)setfill( )setiosflags(ios:left)余額|; coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)存款類型|;coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)住址|;/* *查詢個人卡中信息 */void InquiryIndividual() int y=6,FIELD_WIDTH=18,x=18;printSeperatorLine(y,x);printHeadLine(x);printSeperatorLine(y,x);cout|setw(F

9、IELD_WIDTH)setfill( )setiosflags(ios:left)name|;coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)address|;coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)account|;coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)money|;coutsetw(FIELD_WIDTH)setfill( )setiosflags(ios:left)type|;coutsetw(FIEL

10、D_WIDTH)setfill( )setiosflags(ios:left)addresslink=NULL? true:false; /判斷鏈表是否為空void CreatAccount(); /創(chuàng)建一個賬號void UsersLogIn(); /用戶登錄void ReportTheLost(); /掛失銀行卡void ResetPassword(); /重置密碼void CancelUsers(); /注銷用戶void Transfer(Client * &c1); /轉(zhuǎn)賬:從c1節(jié)點的客戶轉(zhuǎn)賬到其他客戶void Menu(); /主菜單s;void system:makeEmpty()

11、 Client * q;while(first-link!=NULL)q=first-link;first-link=q-link;delete q;int system:Length()const Client * p=first-link;int count=0;while(p!=NULL)p=p-link;count+;return count;Client * system:Search(char h) /搜索與給定字符串相等的節(jié)點,返回節(jié)點地址,若沒有搜索到,返回NULLClient * current=first-link;while(current!=NULL)if(strcmp

12、(h,current-ID_num)=0)break;else current=current-link;return current;Client * system:SearchA(char h)Client * current=first-link;while(current!=NULL)if(strcmp(h,current-account)=0)break;else current=current-link;return current;Client * system:Locate(int i)if(i0) return NULL;Client * current=first;int

13、k=0;while(current!=NULL&klink;k+;return current;bool system:Append(char n,char i,char a,char p,char q,char t,double m) /添加一個節(jié)點到鏈表尾端Client * newNode=new Client(n,i,a,p,q,t,m);last-link=newNode;newNode-link=NULL;last=last-link;return true;void system:CreatAccount() /創(chuàng)建一個客戶賬號信息,若賬號重復(fù),則需重新輸入賬號;若兩次密碼輸入不一

14、致,則需重新輸入密碼char n20;char r20;char q20;char t20;char t120=活期;char t220=死期;for(int i=0;i20;i+)ni=0;ri=0;qi=0;ti=0;coutnntt請輸入姓名:bbbbbbbbbbbbbbbbbbbb;cinn; /輸入姓名coutendl;coutnntt請輸入地址:bbbbbbbbbbbbbbbbbbbb;cinq; /輸入地址while(1)coutnntt請輸入存款類型:(死期or活期)bbbbbbbbbbbbbbbbbbbb;cint; /輸入存款類型if(strcmp(t,t1)!=0)&(s

15、trcmp(t,t2)!=0)coutnntt*請選擇死期或活期!*; else break;while(1)coutnntt請輸入ID號:bbbbbbbbbbbbbbbbbbbb;cinr; /輸入ID號Client * current1=Search(r); /在銀行卡系統(tǒng)鏈表中搜索此賬戶,并判斷鏈表中是否存在此賬戶if(current1!=NULL) coutnntt*該賬號已存在,請重新輸入賬號!*bbbbbbb;else break;char Password120,Password220;for(int i=0;i20;i+)Password1i=0;Password2i=0;wh

16、ile(1)coutnntt請輸入新密碼:bbbbbbbbbbbbbbbbbbbb;cinPassword1;coutendl;coutnntt請再次輸入密碼:bbbbbbbbbbbbbbbbbbbb;cinPassword2;if(strcmp(Password1,Password2)=0)break;coutendl;coutnntt*兩次輸入的密碼不一致,請重新輸入*; char a20; int num,num1,ii=0,jj=0;while(jj0) num1=num%10; num=num/10; num1+=48; aii=num1; ii+; cout您的賬戶號為:aendl

17、;double m=0.0;Append(n,r,a,Password1,q,t,m); /將用戶信息收集之后,加入到銀行卡系統(tǒng)鏈表尾端保存coutnntt*創(chuàng)建賬戶成功!*bbbbbbb;coutendl;void system:UsersLogIn() /用戶登錄char LogInAccount20,LogInPassword20; for(int i=0;i20;i+)LogInAccounti=0;LogInPasswordi=0;coutnnt請輸入賬號:bbbbbbb;cinLogInAccount;coutendl;Client * current=SearchA(LogInA

18、ccount); /在銀行卡系統(tǒng)鏈表中搜索此賬戶,并判斷鏈表中是否存在此賬戶if(current!=NULL) /賬號需存在int LockCount=0; /客戶每輸入密碼錯誤一次LockCount加一,當(dāng)LockCount=3時,銀行卡被鎖定,不能登錄,需解除鎖定才能使用while(LockCount3)coutnnt請輸入密碼:bbbbbbb;cinLogInPassword;if(strcmp(LogInPassword,current-password)=0)break;else LockCount+; coutIsLock=true;coutnnt輸入密碼錯誤三次,您的賬號已被封鎖

19、!bbbbbbb;elseint w;couttn; /客戶菜單coutt| (1)存款 |n;coutt| (2)轉(zhuǎn)賬 |n;coutt| (3)取款 |n;coutt| (4)修改密碼 |n;coutt| (5)查詢個人信息 |n;coutnntt 請選擇操作(1-5):bb;cinw;switch(w)case 1:current-Deposit();break;case 2:Transfer(current);break;case 3:current-Withdrawals();break;case 4:current-ChangPassword();break;case 5:curr

20、ent-InquiryIndividual();break; return;void system:ReportTheLost() /掛失銀行卡,掛失后銀行不能使用char LogInAccount20;for(int i=0;i20;i+)LogInAccounti=0;coutnnt請輸入賬號:bbbbbbb;cinLogInAccount;coutIsLost=true;coutnnt賬號掛失成功!bbbbbbbendl;elsecoutnnt不存在此用戶!bbbbbbbendl;return;void system:Transfer(Client * &c1) /轉(zhuǎn)賬char LogInAccount120,LogInAccount220;for(int i=0;i20;i+)LogInAccount1i=0;LogInAccount2i=0;while(1)coutnnt請輸入需要轉(zhuǎn)入的賬號:bbbbbbb;cinLogInAccount1;coutnnt請再次輸入需要轉(zhuǎn)入的賬號:bbbbbbb;cinLogInAccount2;if(strcmp(LogInAccount1,LogInAccount2)=0)break;else coutnnt兩次賬號輸入不

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論