#include#include #include using namespace std; Class bankaccount { public: bankaccount (string, string); void transferchecking(string, double); void option(); bool loginchecking(); void balancechecking(); void passwordreset(); void withdraw(); void deposit(); void transfer(); private: string accountnumber; string password; double balance; } bool bankaccount::loginchecking() { string x; cin >> pw; if (pw == password) return 1; else return 0; } void bankaccount::option() { cin >> optiontype; while (optiontype != 'q' && optiontype != 'Q') { switch (optiontype) { case 'c' or 'C' : void balancechecking(); break; case 'r' or 'R': void passwordreset(); break; case 'w' or 'W': void withdraw(); break; case 'd' or 'D': void deposit(), break; case 't' or 'T': void transfer(), break; } cin >> optiontype; } string inputaccno; cout << "Enter account number: " } void bankaccount::accountcreate() { int i; account[i]; for (i=0 ; i<10; i++) void accountnogen(account[i].accountnumber) account[i].password = "0000000"; account[i].balance = 0; } void bankaccount::accountnogen(string& str) { static int seed = 1200; char buffer[10]; string strl = "300-475-"; str2 (itoa(seed++, buffer, 10)); str = str1 + str2; } void bankaccount::withdraw() { int wd; cout << "Withdraw: "; cin >> wd; if (wd > balance) cout << "Insufficient fund"; else balance = balance - wd; cout << "$' << balance << "has been withdrawn from your account"; } void bankaccount::deposit() { int dp; cout <<"Deposit: "; cin >> dp; balance = balance + dp; cout << "$" << balance << "has been withdrawn from your account"; } void bankaccount::transfer() { string transfertarget; double transferamount; cout << "Transfer to: "; cin >> transfertarget; cin >> transferamount; int j; for (j=0; j<10, j++) if (transfertarget = account[j].accountnumber && } void main() { bankaccount customer, target; cout << "Account number: "; cin >> inputaccno; cin >> password; customer = bankaccount(string accountnumber, string password); if (bool customer.loginchecking()) { cout << "Welcome " << inputaccno; void customer.option() } }
Text file Source (historic): geocities.com/hk/crazysang1223/cs2331
geocities.com/hk/crazysang1223geocities.com/hk
(to report bad content: archivehelp @ gmail)
|
|
|
|
|