linux ATM自定取款機簡單實現

2021-07-11 16:20:47 字數 2947 閱讀 9957

首先是在linux地下實現的,建立了四個檔案,主要實現流程:

註冊-登陸-存款-取款-轉賬-更改密碼-查詢個人資訊-顯示全部賬戶-退出系統

廢話不多說,直接看**:

blank.h

#include #include #include #include #include #include #include #include using namespace std;

#define max_size 65535

//互斥鎖的初始化

static pthread_mutex_t mutex_lock=pthread_mutex_initializer;

enum status;

//有乙個缺點登出後的賬號不能再使用

struct user

bool operator !=(const user &s)

};//註冊--》登陸--》存款--》取款--》查詢--》顯示全部資訊--》更改密碼--》登出使用者--》退出系統

class bank

~bank() {}

bool operator !=(const user &s)

public:

//轉賬

bool transfer_account(const string& block_name,const int number)

return false;

} //登出使用者 登出後的賬號不能再次使用

bool logout(const string &block_name,const string &passwd)

return false;

} //更改密碼

bool change_passwd(const string &block_name,const string &passwd)

return true;

} //使用者登陸

bool log_in(const string &block_name,const string &passwd)

//判斷身份證是否有效,可以檢視這張身份證開零幾張卡,但遺憾的是我沒有實現

bool effective(const string &id)

return true;

} //將整數轉換成字串

string get_string(int number)

//系統為使用者分配乙個賬號

string get_name()

//系統分配的賬號都以622123開始

string get_block_name()

//使用者註冊函式

bool register(const string &name,const string &id)//使用者註冊

else

return false;

} //尋找已經在vector陣列存在的使用者

vector::iterator find(const string &block_name,const string &passwd)

return vector_user.end();

} ///過載find

vector::iterator find(const string &block_name)

return vector_user.end();

} //存款,存款之前保證使用者已經登陸

bool deposit(const string &block_name,const string &passwd,const int money)//存款

return true;

}return false;

} //取款

bool withdraw_money(const string &block_name,const string &passwd,const int &money)

return false; }

// bool check(const string &block_name,const string &passwd)//用卡號查詢

return key;

}void input()

void register_user()

void bank_function()

if(atm.deposit(block_name,passwd,money))//存款

仿ATM取款機

include include atmoperate.h int cards 5 int pwd 5 int money 5 int flag 5 int i ist int cards 5 int cardid,int n else if cards mid cardid else return ...

模擬ATM取款機

此程式具有查詢餘額,取款,存款功能。模擬atm取款機 2017年4月8日 西安科技大學 汪強 include include include int m 1 控制系統退出 struct user 定義結構體 s void file3 寫餘額 fprintf in,f s.d fclose in vo...

ATM自動取款機程式設計

include include void main long int a,b,c,d,e,f,g,k,i,m,n,o,p,h,x,y,v x 62170042 x是銀行卡賬號62170042 8位數 y 00000000 y 身份證號 8位數 n 0 h 5000 h是銀行賬戶餘額,原本餘額為500...