Functional Requirements of Bank Management System IN C++
- Creating the bank account for the customer
- Deposit amount for the customer
- Withdraw amount for the customer
- Balance Enquiry by the customer
- Show account holder’s full detail
- Closing or terminating a bank account
- Updating the bank account
C++ Code of BANK MANAGEMENT SYSTEM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
#include<iostream> #include<fstream> #include<cctype> #include<iomanip> using namespace std; class Bank_Account { int Money_Deposit; char type; int acno; char name[70]; public: void report() const; int retMoney_Deposit() const; void create_Bank_Account(); void dep(int); int retacno() const; void Display_Account() const; void Updation(); char rettype() const; void draw(int); }; void Bank_Account::Updation() { cout<<"\n\tBank_Account No. : "<<acno; cout<<"\n\tUpdation Bank_Account Holder Name : "; cin.ignore(); cin.getline(name,50); cout<<"\n\tUpdation Type of Bank_Account : "; cin>>type; type=toupper(type); cout<<"\n\tUpdation Balance Total-Money : "; cin>>Money_Deposit; } void Bank_Account::create_Bank_Account() { system("CLS"); cout<<"\n\tPlease Enter the Bank_Account No. : "; cin>>acno; cout<<"\n\n\tPlease Enter the Name of the Bank_Account holder : "; cin.ignore(); cin.getline(name,50); cout<<"\n\tPlease Enter Type of the Bank_Account (C/S) : "; cin>>type; type=toupper(type); cout<<"\n\tPlease Enter The Starting Total-Money : "; cin>>Money_Deposit; cout<<"\n\n\tBank_Account Created.."; } void Bank_Account::Display_Account() const { cout<<"\n\tBank_Account No. : "<<acno; cout<<"\n\tBank_Account Holder Name : "; cout<<name; cout<<"\n\tType of Bank_Account : "<<type; cout<<"\n\tBalance Total-Money : "<<Money_Deposit; } int Bank_Account::retacno() const { return acno; } char Bank_Account::rettype() const { return type; } void Bank_Account::report() const { cout<<acno<<setw(10)<<" "<<name<<setw(10)<<" "<<type<<setw(6)<<Money_Deposit<<endl; } void Bank_Account::dep(int x) { Money_Deposit+=x; } void Bank_Account::draw(int x) { Money_Deposit-=x; } int Bank_Account::retMoney_Deposit() const { return Money_Deposit; } void write_Bank_Account(); void display_sp(int); void display_all(); void delete_Bank_Account(int); void Money_Deposit_withdraw(int, int); void Updation_Bank_Account(int); int main() { char ch; int num; do { system("CLS"); cout<<"\n\n\t\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; cout<<"\t\tBANK MANAGEMENT SYSTEM"; cout<<"\n\t\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; cout<<"\t\t ::MAIN MENU::\n"; cout<<"\n\t\t1. NEW Bank_Account"; cout<<"\n\t\t2. Money_Deposit Total-Money"; cout<<"\n\t\t3. WITHDRAW Total-Money"; cout<<"\n\t\t4. BALANCE ENQUIRY"; cout<<"\n\t\t5. ALL Bank_Account HOLDER LIST"; cout<<"\n\t\t6. CLOSE AN Bank_Account"; cout<<"\n\t\t7. Updation AN Bank_Account"; cout<<"\n\t\t8. EXIT"; cout<<"\n\n\t\tSelect Your Option (1-8): "; cin>>ch; switch(ch) { case '1': write_Bank_Account(); break; case '2': system("CLS"); cout<<"\n\n\tPlease Enter The Bank_Account No. : "; cin>>num; Money_Deposit_withdraw(num, 1); break; case '3': system("CLS"); cout<<"\n\n\tPlease Enter The Bank_Account No. : "; cin>>num; Money_Deposit_withdraw(num, 2); break; case '4': system("CLS"); cout<<"\n\n\tPlease Enter The Bank_Account No. : "; cin>>num; display_sp(num); break; case '5': display_all(); break; case '6': system("CLS"); cout<<"\n\n\tPlease Enter The Bank_Account No. : "; cin>>num; delete_Bank_Account(num); break; case '7': system("CLS"); cout<<"\n\n\tPlease Enter The Bank_Account No. : "; cin>>num; Updation_Bank_Account(num); break; case '8': system("CLS"); cout<<"\n\n\tBrought To You By code-projects.org"; break; default :cout<<"\a"; } cin.ignore(); cin.get(); }while(ch!='8'); return 0; } void write_Bank_Account() { Bank_Account ac; ofstream outFile; outFile.open("Bank_Account.dat",ios::binary|ios::app); ac.create_Bank_Account(); outFile.write(reinterpret_cast<char *> (&ac), sizeof(Bank_Account)); outFile.close(); } void delete_Bank_Account(int n) { Bank_Account ac; ifstream inFile; ofstream outFile; inFile.open("Bank_Account.dat",ios::binary); if(!inFile) { cout<<"File could not be open !! Press any Key..."; return; } outFile.open("Temp.dat",ios::binary); inFile.seekg(0,ios::beg); while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(Bank_Account))) { if(ac.retacno()!=n) { outFile.write(reinterpret_cast<char *> (&ac), sizeof(Bank_Account)); } } inFile.close(); outFile.close(); remove("Bank_Account.dat"); rename("Temp.dat","Bank_Account.dat"); cout<<"\n\nRecord Deleted .."; } void display_sp(int n) { Bank_Account ac; bool flag=false; ifstream inFile; inFile.open("Bank_Account.dat",ios::binary); if(!inFile) { cout<<"File could not be open !! Press any Key..."; return; } cout<<"\n\tBALANCE DETAILS\n"; while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(Bank_Account))) { if(ac.retacno()==n) { ac.Display_Account(); flag=true; } } inFile.close(); if(flag==false) cout<<"\n\n\tBank_Account number does not exist"; } void display_all() { system("CLS"); Bank_Account ac; ifstream inFile; inFile.open("Bank_Account.dat",ios::binary); if(!inFile) { cout<<"File could not be open !! Press any Key..."; return; } cout<<"\n\n\t\tBank_Account HOLDER LIST\n\n"; cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!========\n"; cout<<"A/c no. NAME Type Balance\n"; cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!========\n"; while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(Bank_Account))) { ac.report(); } inFile.close(); } void Updation_Bank_Account(int n) { bool found=false; Bank_Account ac; fstream File; File.open("Bank_Account.dat",ios::binary|ios::in|ios::out); if(!File) { cout<<"File could not be open !! Press any Key..."; return; } while(!File.eof() && found==false) { File.read(reinterpret_cast<char *> (&ac), sizeof(Bank_Account)); if(ac.retacno()==n) { ac.Display_Account(); cout<<"\n\n\tPlease Enter The New Details of Bank_Account"<<endl; ac.Updation(); int pos=(-1)*static_cast<int>(sizeof(Bank_Account)); File.seekp(pos,ios::cur); //fncallat1353 File.write(reinterpret_cast<char *> (&ac), sizeof(Bank_Account)); cout<<"\n\n\tRecord Updated"; found=true; } } File.close(); if(found==false) cout<<"\n\n\tRecord Not Found "; } void Money_Deposit_withdraw(int n, int option) { int amt; bool found=false; Bank_Account ac; fstream File; File.open("Bank_Account.dat", ios::binary|ios::in|ios::out); if(!File) { cout<<"File could not be open !! Press any Key..."; return; } while(!File.eof() && found==false) { File.read(reinterpret_cast<char *> (&ac), sizeof(Bank_Account)); if(ac.retacno()==n) { ac.Display_Account(); if(option==1) { cout<<"\n\n\tTO Money_DepositSS Total-Money"; cout<<"\n\n\tPlease Enter The Total-Money to be Money_Deposited: "; cin>>amt; ac.dep(amt); } if(option==2) { cout<<"\n\n\tTO WITHDRAW Total-Money"; cout<<"\n\n\tPlease Enter The Total-Money to be withdraw: "; cin>>amt; int bal=ac.retMoney_Deposit()-amt; if(bal<0) cout<<"Insufficience balance"; else ac.draw(amt); } int pos=(-1)*static_cast<int>(sizeof(ac)); File.seekp(pos,ios::cur);//fn1353 File.write(reinterpret_cast<char *> (&ac), sizeof(Bank_Account)); cout<<"\n\n\tRecord Updated"; found=true; } } File.close(); if(found==false) cout<<"\n\n\tRecord Not Found "; } |
Output

Download Bank Management System in C++
BANK MANAGEMENT SYSTEM USING C++ – Project 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
//HEADER FILE USED IN PROJECT #include<iostream> #include<fstream> #include<cctype> #include<iomanip> using namespace std; // CLASS USED IN PROJECT class account { int Account_No; char Account_Holder_Name[44]; char type; int Deposit_Amount; public: void Open_account(); //function to get data from user void Display_account() const; //function to show data on screen void Update(); //function to add new data void dep(int); //function to accept amount and add to balance amount void Withdraw(int); //function to accept amount and subtract from balance amount void report() const; //function to show data in tabular format int Return_Account_Number() const; //function to return account number int Return_Deposit_Amount() const; //function to return balance amount char Return_type() const; //function to return type of account }; //class ends here void account::Display_account() const { cout<<"\nAccount No. : "<<Account_No; cout<<"\nAccount Holder Name : "; cout<<Account_Holder_Name; cout<<"\nType of Account : "<<type; cout<<"\nBalance amount : "<<Deposit_Amount; } void account::Open_account() { cout<<"\nPlease! Enter The account No. :"; cin>>Account_No; cout<<"\nPlease! Enter The Name of The account Holder : "; cin.ignore(); cin.getline(Account_Holder_Name,44); cout<<"\nPlease! Enter Type of The account (C/S) : "; cin>>type; type=toupper(type); cout<<"\nPlease! Enter The Initial amount(>=440 for Saving and >=1000 for current ) : "; cin>>Deposit_Amount; cout<<"\n\nAccount Created.."; } void account::dep(int x) { Deposit_Amount+=x; } void account::Withdraw(int x) { Deposit_Amount-=x; } void account::report() const { cout<<Account_No<<setw(10)<<" "<<Account_Holder_Name<<setw(10)<<" "<<type<<setw(6)<<Deposit_Amount<<endl; } void account::Update() { cout<<"\nAccount No. : "<<Account_No; cout<<"\nUpdate Account Holder Name : "; cin.ignore(); cin.getline(Account_Holder_Name,44); cout<<"\nUpdate Type of Account : "; cin>>type; type=toupper(type); cout<<"\nUpdate Balance amount : "; cin>>Deposit_Amount; } int account::Return_Account_Number() const { return Account_No; } char account::Return_type() const { return type; } int account::Return_Deposit_Amount() const { return Deposit_Amount; } //function declaration void delete_account(int); //function to delete record of file void display_all(); //function to display all account details void write_account(); //function to write record in binary file void display_sp(int); //function to display account details given by user void Deposit_Amount_withWithdraw(int, int); // function to desposit/withWithdraw amount for given account void intro(); //introductory screen function void Update_account(int); //function to Update record of file //THE MAIN FUNCTION OF PROGRAM int main() { char ch; int num; intro(); do { system("cls"); cout<<"\n\n\t\tMAIN MENU"; cout<<"\n\t\t01. NEW ACCOUNT"; cout<<"\n\t\t02. Deposit_Amount AMOUNT"; cout<<"\n\t\t03. WITHWithdraw AMOUNT"; cout<<"\n\t\t04. BALANCE ENQUIRY"; cout<<"\n\t\t05. ALL ACCOUNT HOLDER LIST"; cout<<"\n\t\t06. CLOSE AN ACCOUNT"; cout<<"\n\t\t07. Update AN ACCOUNT"; cout<<"\n\t\t08. EXIT"; cout<<"\n\t\tSelect Your Option (1-8) "; cin>>ch; system("cls"); switch(ch) { case '1': write_account(); break; case '2': cout<<"\n\t\tPlease! Enter The account No. : "; cin>>num; Deposit_Amount_withWithdraw(num, 1); break; case '3': cout<<"\n\t\tPlease! Enter The account No. : "; cin>>num; Deposit_Amount_withWithdraw(num, 2); break; case '4': cout<<"\n\t\tPlease! Enter The account No. : "; cin>>num; display_sp(num); break; case '5': display_all(); break; case '6': cout<<"\n\t\tPlease! Enter The account No. : "; cin>>num; delete_account(num); break; case '7': cout<<"\n\t\tPlease! Enter The account No. : "; cin>>num; Update_account(num); break; case '8': cout<<"\n\t\tThanks for using bank managemnt system"; break; default :cout<<"\a"; } cin.ignore(); cin.get(); }while(ch!='8'); return 0; } //function to write in file void write_account() { account ac; ofstream outFile; outFile.open("account.dat",ios::binary|ios::app); ac.Open_account(); outFile.write(reinterpret_cast<char *> (&ac), sizeof(account)); outFile.close(); } //function to read specific record from file void display_sp(int n) { account ac; bool flag=false; ifstream inFile; inFile.open("account.dat",ios::binary); if(!inFile) { cout<<"File could not be open !! Press any Key..."; return; } cout<<"\nBALANCE DETAILS\n"; while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account))) { if(ac.Return_Account_Number()==n) { ac.Display_account(); flag=true; } } inFile.close(); if(flag==false) cout<<"\nAccount number does not exist"; } //function to Update record of file void Update_account(int n) { bool found=false; account ac; fstream File; File.open("account.dat",ios::binary|ios::in|ios::out); if(!File) { cout<<"File could not be open !! Press any Key..."; return; } while(!File.eof() && found==false) { File.read(reinterpret_cast<char *> (&ac), sizeof(account)); if(ac.Return_Account_Number()==n) { ac.Display_account(); cout<<"\nPlease! Enter The New Details of account"<<endl; ac.Update(); int pos=(-1)*static_cast<int>(sizeof(account)); File.seekp(pos,ios::cur); File.write(reinterpret_cast<char *> (&ac), sizeof(account)); cout<<"\n\t\t Record Updated"; found=true; } } File.close(); if(found==false) cout<<"\n Record Not Found "; } //function to delete record of file void delete_account(int n) { account ac; ifstream inFile; ofstream outFile; inFile.open("account.dat",ios::binary); if(!inFile) { cout<<"File could not be open !! Press any Key..."; return; } outFile.open("Temp.dat",ios::binary); inFile.seekg(0,ios::beg); while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account))) { if(ac.Return_Account_Number()!=n) { outFile.write(reinterpret_cast<char *> (&ac), sizeof(account)); } } inFile.close(); outFile.close(); remove("account.dat"); rename("Temp.dat","account.dat"); cout<<"\n\t\tRecord Deleted .."; } //function to display all accounts Deposit_Amount list void display_all() { account ac; ifstream inFile; inFile.open("account.dat",ios::binary); if(!inFile) { cout<<"File could not be open !! Press any Key..."; return; } cout<<"\n\t\t\t\tACCOUNT HOLDER LIST\n"; cout<<"*************************\n"; cout<<"A/c no. NAME Type Balance\n"; cout<<"*************************\n"; while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account))) { ac.report(); } inFile.close(); } // function to Deposit_Amount and withWithdraw amounts void Deposit_Amount_withWithdraw(int n, int option) { int Amount; bool found=false; account ac; fstream File; File.open("account.dat", ios::binary|ios::in|ios::out); if(!File) { cout<<"File could not be open !! Press any Key..."; return; } while(!File.eof() && found==false) { File.read(reinterpret_cast<char *> (&ac), sizeof(account)); if(ac.Return_Account_Number()==n) { ac.Display_account(); if(option==1) { cout<<"\n\t\tTO Deposit_AmountE AMOUNT "; cout<<"\nPlease! Enter The amount to be Deposit_Amounted"; cin>>Amount; ac.dep(Amount); } if(option==2) { cout<<"\n\t\tTO WITHWithdraw AMOUNT "; cout<<"\nPlease! Enter The amount to be withWithdraw"; cin>>Amount; int bal=ac.Return_Deposit_Amount()-Amount; if((bal<440 && ac.Return_type()=='S') || (bal<1000 && ac.Return_type()=='C')) cout<<"Insufficience balance"; else ac.Withdraw(Amount); } int pos=(-1)*static_cast<int>(sizeof(ac)); File.seekp(pos,ios::cur); File.write(reinterpret_cast<char *> (&ac), sizeof(account)); cout<<"\n\t\t Record Updated"; found=true; } } File.close(); if(found==false) cout<<"\n Record Not Found "; } //INTRODUCTION FUNCTION void intro() { cout<<"\n\n\t\t BANK"; cout<<"\n\t\tMANAGEMENT"; cout<<"\n\t\t SYSTEM"; cout<<"\n\nMADE BY : your name"; cout<<"\nSCHOOL : your school name"; cin.get(); } |
Output
BANK
MANAGEMENT
SYSTEM
MADE BY : your name
SCHOOL : your school name
MAIN MENU
01. NEW ACCOUNT
02. Deposit_Amount AMOUNT
03. WITHWithdraw AMOUNT
04. BALANCE ENQUIRY
05. ALL ACCOUNT HOLDER LIST
06. CLOSE AN ACCOUNT
07. Update AN ACCOUNT
08. EXIT
Select Your Option (1-8)
Please! Enter The account No. :999
Please! Enter The Name of The account Holder : shamil
Please! Enter Type of The account (C/S) : C
Please! Enter The Initial amount(>=440 for Saving and >=1000 for current ) : 5000
Account Created..
Please! Enter The account No. : 999
Account No. : 999
Account Holder Name : shamil
Type of Account : C
Balance amount : 5000
TO WITHWithdraw AMOUNT
Please! Enter The amount to be Withdraw