{"id":14903,"date":"2023-07-27T14:44:52","date_gmt":"2023-07-27T09:14:52","guid":{"rendered":"http:\/\/myprojectideas.com\/?p=14903"},"modified":"2025-10-10T11:41:28","modified_gmt":"2025-10-10T11:41:28","slug":"bank-management-system-with-c","status":"publish","type":"post","link":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/","title":{"rendered":"Bank Management System with C++"},"content":{"rendered":"<p>We have designed this Bank Management System with C++\u00a0 to simulate typical banking operations. It has been built to provide a hands-on experience with concepts of Object-Oriented Programming, file handling, and system design. This C++ project allows users to create and manage bank accounts, execute transactions, and handle other banking tasks, all through a command-line interface.<\/p>\n<iframe loading=\"lazy\"  id=\"_ytid_91081\"  width=\"1080\" height=\"607\"  data-origwidth=\"1080\" data-origheight=\"607\" src=\"https:\/\/www.youtube.com\/embed\/DJPc5-3-mIE?enablejsapi=1&autoplay=0&cc_load_policy=0&cc_lang_pref=&iv_load_policy=1&loop=0&rel=1&fs=1&playsinline=0&autohide=2&theme=dark&color=red&controls=1&\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe>\n<h2>Introduction<\/h2>\n<p>The Bank management system deals with the concept of making a complete record of a customer\u2019s account. The system utilizes key concepts from Object-Oriented Programming and allows users to manage their bank accounts in an interactive way through the following operations:<\/p>\n<ul>\n<li>Creating a new bank account<\/li>\n<li>Depositing money into an account<\/li>\n<li>Withdrawing money from an account<\/li>\n<li>Checking the balance of an account<\/li>\n<li>Displaying the details of all account holders<\/li>\n<li>Closing an account<\/li>\n<li>Modifying the details of an account<\/li>\n<\/ul>\n<h2>Objectives<\/h2>\n<p>The main objectives of this Bank Management System with C++ are as follows:<\/p>\n<p><span data-preserver-spaces=\"true\">1. Implement a simple bank management system in C++ with object-oriented programming concepts and a text-based user interface for users to interact with the system. Our system will include options for creating new accounts, depositing money, withdrawing money, viewing account details, and more.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">2. Use a class <em><strong>Bank_account<\/strong><\/em> to represent individual bank accounts. Each Bank_account object encapsulates data members like account number, account holder&#8217;s name, account type, and deposit amount.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">3. Allow the creation of a new bank account with user-provided details such as account number, account holder&#8217;s name, account type, and initial deposit amount. Other functions provided are:<\/span><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\">Enable viewing details of a specific account given the account number.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">Allow modification of an existing account&#8217;s details.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">Enable deposit of an amount into an account or withdrawal from an account.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">Provide the ability to delete an account.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">Display all the accounts held in the bank, providing a brief report of each account.<\/span><\/li>\n<\/ul>\n<p><span data-preserver-spaces=\"true\">4. Manage data persistence by using file I\/O operations to store and retrieve bank account data. The program saves all the accounts in a binary file named <em><strong>&#8220;account.dat&#8221;.<\/strong><\/em><\/span><\/p>\n<p><span data-preserver-spaces=\"true\">5. Loop the main menu until the user chooses to exit, enabling multiple operations in a single run of the program.<\/span><\/p>\n<h2>Requirements<\/h2>\n<p><strong><span data-preserver-spaces=\"true\">1. C++ Compiler<\/span><\/strong><span data-preserver-spaces=\"true\">: You need a C++ compiler to compile and run this code. Some popular C++ compilers include GCC, <a href=\"https:\/\/clang.llvm.org\/\">Clang<\/a>, and <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/features\/cplusplus\/\">MSVC<\/a>. Integrated Development Environments (IDEs) like Code::Blocks, Visual Studio, or online platforms like <a href=\"https:\/\/replit.com\/\">Repl.it<\/a> are also suitable for running this code.<\/span><\/p>\n<p><strong><span data-preserver-spaces=\"true\">2. Basic Understanding of C++<\/span><\/strong><span data-preserver-spaces=\"true\">: This code is written in C++, so having a basic understanding of C++ programming is crucial. This includes knowledge of classes and objects, file I\/O, control statements (like if, switch, while), and input\/output operations.<\/span><\/p>\n<p><strong><span data-preserver-spaces=\"true\">3. Operating System<\/span><\/strong><span data-preserver-spaces=\"true\">: As the code uses a <a href=\"https:\/\/www.geeksforgeeks.org\/clear-console-c-language\/\">system(&#8220;CLS&#8221;)<\/a> command, it is supposed to be run in a Windows environment because &#8220;CLS&#8221; is a command specific to the Windows command prompt. If you&#8217;re running on a Unix-like system (like Linux or macOS), you might need to replace &#8220;CLS&#8221; with &#8220;clear&#8221;.<\/span><\/p>\n<p><strong><span data-preserver-spaces=\"true\">4. File System Permissions<\/span><\/strong><span data-preserver-spaces=\"true\">: This program creates and manipulates files (&#8220;account.dat&#8221; and &#8220;Temp.dat&#8221;) in the same directory as the executable. You need to ensure that the directory where you run the program has write permissions.<\/span><\/p>\n<h2>Source Code<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">#include&lt;iostream&gt;\r\n\r\n#include&lt;fstream&gt;\r\n\r\n#include&lt;cctype&gt;\r\n\r\n#include&lt;iomanip&gt;\r\n\r\nusing namespace std;\r\n\r\nclass Bank_account\r\n\r\n{\r\n\r\nint acno;\r\n\r\nchar name[50];\r\n\r\nint deposit;\r\n\r\nchar type;\r\n\r\npublic:\r\n\r\nvoid create_account();\r\n\r\nvoid show_account() const;\r\n\r\nvoid modify();\r\n\r\nvoid dep(int);\r\n\r\nvoid draw(int);\r\n\r\nvoid report() const;\r\n\r\nint retacno() const;\r\n\r\nint retdeposit() const;\r\n\r\nchar rettype() const;\r\n\r\n};\r\n\r\nvoid Bank_account::create_account()\r\n\r\n{\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tEnter the Account No. : \";\r\n\r\ncin&gt;&gt;acno;\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter the Name of the Account holder : \";\r\n\r\ncin.ignore();\r\n\r\ncin.getline(name,50);\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tEnter Type of the Account (C\/S) : \";\r\n\r\ncin&gt;&gt;type;\r\n\r\ntype=toupper(type);\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tEnter The Initial amount : \";\r\n\r\ncin&gt;&gt;deposit;\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tAccount Created..\";\r\n\r\n}\r\n\r\nvoid Bank_account::show_account() const\r\n\r\n{\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tAccount No. : \"&lt;&lt;acno;\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tAccount Holder Name : \";\r\n\r\ncout&lt;&lt;name;\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tType of Account : \"&lt;&lt;type;\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tBalance amount : \"&lt;&lt;deposit;\r\n\r\n}\r\n\r\nvoid Bank_account::modify()\r\n\r\n{\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tAccount No. : \"&lt;&lt;acno;\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tModify Account Holder Name : \";\r\n\r\ncin.ignore();\r\n\r\ncin.getline(name,50);\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tModify Type of Account : \";\r\n\r\ncin&gt;&gt;type;\r\n\r\ntype=toupper(type);\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tModify Balance amount : \";\r\n\r\ncin&gt;&gt;deposit;\r\n\r\n}\r\n\r\nvoid Bank_account::dep(int x)\r\n\r\n{\r\n\r\ndeposit+=x;\r\n\r\n}\r\n\r\nvoid Bank_account::draw(int x)\r\n\r\n{\r\n\r\ndeposit-=x;\r\n\r\n}\r\n\r\nvoid Bank_account::report() const\r\n\r\n{\r\n\r\ncout&lt;&lt;acno&lt;&lt;setw(10)&lt;&lt;\" \"&lt;&lt;name&lt;&lt;setw(10)&lt;&lt;\" \"&lt;&lt;type&lt;&lt;setw(6)&lt;&lt;deposit&lt;&lt;endl;\r\n\r\n}\r\n\r\nint Bank_account::retacno() const\r\n\r\n{\r\n\r\nreturn acno;\r\n\r\n}\r\n\r\nint Bank_account::retdeposit() const\r\n\r\n{\r\n\r\nreturn deposit;\r\n\r\n}\r\n\r\nchar Bank_account::rettype() const\r\n\r\n{\r\n\r\nreturn type;\r\n\r\n}\r\n\r\nvoid write_account();\r\n\r\nvoid display_sp(int);\r\n\r\nvoid modify_account(int);\r\n\r\nvoid delete_account(int);\r\n\r\nvoid display_all();\r\n\r\nvoid deposit_withdraw(int, int);\r\n\r\nint main()\r\n\r\n{\r\n\r\nchar ch;\r\n\r\nint num;\r\n\r\ndo\r\n\r\n{\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\t\\t======================\\n\";\r\n\r\ncout&lt;&lt;\"\\t\\t\\t\\tBANK MANAGEMENT SYSTEM\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t======================\\n\";\r\n\r\ncout&lt;&lt;\"\\t\\t\\t\\t ::MAIN MENU::\\n\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t1. NEW ACCOUNT\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t2. DEPOSIT AMOUNT\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t3. WITHDRAW AMOUNT\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t4. BALANCE ENQUIRY\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t5. ALL ACCOUNT HOLDER LIST\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t6. CLOSE AN ACCOUNT\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t7. MODIFY AN ACCOUNT\";\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\t\\t8. EXIT\";\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\t\\tSelect Your Option (1-8): \";\r\n\r\ncin&gt;&gt;ch;\r\n\r\nswitch(ch)\r\n\r\n{\r\n\r\ncase '1':\r\n\r\nwrite_account();\r\n\r\nbreak;\r\n\r\ncase '2':\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The account No. : \"; cin&gt;&gt;num;\r\n\r\ndeposit_withdraw(num, 1);\r\n\r\nbreak;\r\n\r\ncase '3':\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The account No. : \"; cin&gt;&gt;num;\r\n\r\ndeposit_withdraw(num, 2);\r\n\r\nbreak;\r\n\r\ncase '4':\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The account No. : \"; cin&gt;&gt;num;\r\n\r\ndisplay_sp(num);\r\n\r\nbreak;\r\n\r\ncase '5':\r\n\r\ndisplay_all();\r\n\r\nbreak;\r\n\r\ncase '6':\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The account No. : \"; cin&gt;&gt;num;\r\n\r\ndelete_account(num);\r\n\r\nbreak;\r\n\r\ncase '7':\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The account No. : \"; cin&gt;&gt;num;\r\n\r\nmodify_account(num);\r\n\r\nbreak;\r\n\r\ncase '8':\r\n\r\nsystem(\"CLS\");\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tBrought To You By code-projects.org\";\r\n\r\nbreak;\r\n\r\ndefault :cout&lt;&lt;\"\\a\";\r\n\r\n}\r\n\r\ncin.ignore();\r\n\r\ncin.get();\r\n\r\n}while(ch!='8');\r\n\r\nreturn 0;\r\n\r\n}\r\n\r\nvoid write_account()\r\n\r\n{\r\n\r\nBank_account ac;\r\n\r\nofstream outFile;\r\n\r\noutFile.open(\"account.dat\",ios::binary|ios::app);\r\n\r\nac.create_account();\r\n\r\noutFile.write(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account));\r\n\r\noutFile.close();\r\n\r\n}\r\n\r\nvoid display_sp(int n)\r\n\r\n{\r\n\r\nBank_account ac;\r\n\r\nbool flag=false;\r\n\r\nifstream inFile;\r\n\r\ninFile.open(\"account.dat\",ios::binary);\r\n\r\nif(!inFile)\r\n\r\n{\r\n\r\ncout&lt;&lt;\"File could not be open !! Press any Key...\";\r\n\r\nreturn;\r\n\r\n}\r\n\r\ncout&lt;&lt;\"\\n\\t\\t\\tBALANCE DETAILS\\n\";\r\n\r\nwhile(inFile.read(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account)))\r\n\r\n{\r\n\r\nif(ac.retacno()==n)\r\n\r\n{\r\n\r\nac.show_account();\r\n\r\nflag=true;\r\n\r\n}\r\n\r\n}\r\n\r\ninFile.close();\r\n\r\nif(flag==false)\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tAccount number does not exist\";\r\n\r\n}\r\n\r\nvoid modify_account(int n)\r\n\r\n{\r\n\r\nbool found=false;\r\n\r\nBank_account ac;\r\n\r\nfstream File;\r\n\r\nFile.open(\"account.dat\",ios::binary|ios::in|ios::out);\r\n\r\nif(!File)\r\n\r\n{\r\n\r\ncout&lt;&lt;\"File could not be open !! Press any Key...\";\r\n\r\nreturn;\r\n\r\n}\r\n\r\nwhile(!File.eof() &amp;&amp; found==false)\r\n\r\n{\r\n\r\nFile.read(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account));\r\n\r\nif(ac.retacno()==n)\r\n\r\n{\r\n\r\nac.show_account();\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The New Details of account\"&lt;&lt;endl;\r\n\r\nac.modify();\r\n\r\nint pos=(-1)*static_cast&lt;int&gt;(sizeof(Bank_account));\r\n\r\nFile.seekp(pos,ios::cur); \/\/fncallat1353\r\n\r\nFile.write(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account));\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tRecord Updated\";\r\n\r\nfound=true;\r\n\r\n}\r\n\r\n}\r\n\r\nFile.close();\r\n\r\nif(found==false)\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tRecord Not Found \";\r\n\r\n}\r\n\r\nvoid delete_account(int n)\r\n\r\n{\r\n\r\nBank_account ac;\r\n\r\nifstream inFile;\r\n\r\nofstream outFile;\r\n\r\ninFile.open(\"account.dat\",ios::binary);\r\n\r\nif(!inFile)\r\n\r\n{\r\n\r\ncout&lt;&lt;\"File could not be open !! Press any Key...\";\r\n\r\nreturn;\r\n\r\n}\r\n\r\noutFile.open(\"Temp.dat\",ios::binary);\r\n\r\ninFile.seekg(0,ios::beg);\r\n\r\nwhile(inFile.read(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account)))\r\n\r\n{\r\n\r\nif(ac.retacno()!=n)\r\n\r\n{\r\n\r\noutFile.write(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account));\r\n\r\n}\r\n\r\n}\r\n\r\ninFile.close();\r\n\r\noutFile.close();\r\n\r\nremove(\"account.dat\");\r\n\r\nrename(\"Temp.dat\",\"account.dat\");\r\n\r\ncout&lt;&lt;\"\\n\\nRecord Deleted ..\";\r\n\r\n}\r\n\r\nvoid display_all()\r\n\r\n{\r\n\r\nsystem(\"CLS\");\r\n\r\nBank_account ac;\r\n\r\nifstream inFile;\r\n\r\ninFile.open(\"account.dat\",ios::binary);\r\n\r\nif(!inFile)\r\n\r\n{\r\n\r\ncout&lt;&lt;\"File could not be open !! Press any Key...\";\r\n\r\nreturn;\r\n\r\n}\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\tACCOUNT HOLDER LIST\\n\\n\";\r\n\r\ncout&lt;&lt;\"====================================================\\n\";\r\n\r\ncout&lt;&lt;\"A\/c no. NAME Type Balance\\n\";\r\n\r\ncout&lt;&lt;\"====================================================\\n\";\r\n\r\nwhile(inFile.read(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account)))\r\n\r\n{\r\n\r\nac.report();\r\n\r\n}\r\n\r\ninFile.close();\r\n\r\n}\r\n\r\nvoid deposit_withdraw(int n, int option)\r\n\r\n{\r\n\r\nint amt;\r\n\r\nbool found=false;\r\n\r\nBank_account ac;\r\n\r\nfstream File;\r\n\r\nFile.open(\"account.dat\", ios::binary|ios::in|ios::out);\r\n\r\nif(!File)\r\n\r\n{\r\n\r\ncout&lt;&lt;\"File could not be open !! Press any Key...\";\r\n\r\nreturn;\r\n\r\n}\r\n\r\nwhile(!File.eof() &amp;&amp; found==false)\r\n\r\n{\r\n\r\nFile.read(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account));\r\n\r\nif(ac.retacno()==n)\r\n\r\n{\r\n\r\nac.show_account();\r\n\r\nif(option==1)\r\n\r\n{\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tTO DEPOSITSS AMOUNT\";\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The amount to be deposited: \";\r\n\r\ncin&gt;&gt;amt;\r\n\r\nac.dep(amt);\r\n\r\n}\r\n\r\nif(option==2)\r\n\r\n{\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tTO WITHDRAW AMOUNT\";\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tEnter The amount to be withdraw: \";\r\n\r\ncin&gt;&gt;amt;\r\n\r\nint bal=ac.retdeposit()-amt;\r\n\r\nif(bal&lt;0)\r\n\r\ncout&lt;&lt;\"Insufficience balance\";\r\n\r\nelse\r\n\r\nac.draw(amt);\r\n\r\n}\r\n\r\nint pos=(-1)*static_cast&lt;int&gt;(sizeof(ac));\r\n\r\nFile.seekp(pos,ios::cur);\/\/fn1353\r\n\r\nFile.write(reinterpret_cast&lt;char *&gt; (&amp;ac), sizeof(Bank_account));\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tRecord Updated\";\r\n\r\nfound=true;\r\n\r\n}\r\n\r\n}\r\n\r\nFile.close();\r\n\r\nif(found==false)\r\n\r\ncout&lt;&lt;\"\\n\\n\\t\\t\\tRecord Not Found \";\r\n\r\n}<\/pre>\n<h2><a id=\"post-14903-_heading=h.wcxu932u8b7e\"><\/a>Explanation of the Code<\/h2>\n<p><em>Let us have a look at the functionalities of the above-written code for the Bank management system with C++:<\/em><\/p>\n<p><strong><span data-preserver-spaces=\"true\">Bank_account Class Methods<\/span>:<\/strong><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\"><em><strong>create_account():<\/strong><\/em> This function prompts the user to enter details such as account number, name, account type (C for Checking, S for Saving), and the initial deposit amount. It stores this information in the object&#8217;s member variables.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>show_account() const:<\/strong><\/em> This function displays the details of an account, such as the account number, account holder&#8217;s name, type of account, and the balance amount.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>modify():<\/strong><\/em> This function modifies the details of an existing account. It prompts the user to enter the new account holder&#8217;s name, type of account, and balance amount.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>dep(int x):<\/strong><\/em> This function is used to deposit an amount (x) into the account. It increases the account&#8217;s deposit amount by the entered amount (x).<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>draw(int x):<\/strong><\/em> This function is used to withdraw an amount (x) from the account. It decreases the account&#8217;s deposit amount by the entered amount (x).<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>report() const:<\/strong><\/em> This function is used to print the account&#8217;s details in a specific format suitable for listing all accounts.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>retacno() const, retdeposit() const, and rettype() const:<\/strong><\/em> These functions return the account number, deposit amount, and account type respectively. They are used for various operations, such as searching for an account or verifying the balance.<\/span><\/li>\n<\/ul>\n<p><strong><span data-preserver-spaces=\"true\">Main Function<\/span><\/strong><span data-preserver-spaces=\"true\"><strong>:<\/strong> The main function runs a loop that prints a menu to the user and executes the user&#8217;s chosen operation. The operations are performed using a switch statement that calls different functions based on user input.<\/span><\/p>\n<p><strong><span data-preserver-spaces=\"true\">Other Functions<\/span>:<\/strong><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\"><em><strong>write_account():<\/strong><\/em> This function is used to create a new account. It creates an object of the Bank_account class, calls the create_account() function to get the account details from the user, and writes the object to the &#8220;account.dat&#8221; file.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>display_sp(int n):<\/strong><\/em> This function displays the details of a specific account. It opens the &#8220;account.dat&#8221; file, reads each account, and displays the account details if the account number matches the input (n).<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>modify_account(int n):<\/strong><\/em> This function modifies the details of a specific account. It opens the &#8220;account.dat&#8221; file, reads each account until it finds the account with the number (n), modifies the details using the modify() function, and writes the updated account back to the file.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>delete_account(int n):<\/strong> <\/em>This function deletes a specific account. It opens the &#8220;account.dat&#8221; file and the &#8220;Temp.dat&#8221; file, reads each account from &#8220;account.dat&#8221;, and writes the account to &#8220;Temp.dat&#8221; only if the account number does not match the input (n). Then it deletes &#8220;account.dat&#8221; and renames &#8220;Temp.dat&#8221; to &#8220;account.dat&#8221;.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>display_all():<\/strong><\/em> This function displays all accounts. It opens the &#8220;account.dat&#8221; file, reads each account, and displays its details using the report() function.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\"><em><strong>deposit_withdraw(int n, int option):<\/strong><\/em> This function handles deposit and withdrawal operations. It opens the &#8220;account.dat&#8221; file, reads each account until it finds the account with the number (n), and then either deposits or withdraws an amount based on the input (option). It then writes the updated account back to the file.<\/span><\/li>\n<\/ul>\n<h2>Output<\/h2>\n<p>There are 8 options in the main menu, and the user can select any of them one by one.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-17486 size-full\" src=\"https:\/\/rudelabs.ai\/blogs\/wp-content\/uploads\/2023\/07\/word-image-14903-1.webp\" alt=\"Bank Management System with C++\" width=\"396\" height=\"426\" \/><\/p>\n<p>Selecting option 1 will create a new account in which the user is asked for the necessary details like account number, name of the account holder, account type, and initial amount. Thus, the account is created successfully.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-17487 size-full\" src=\"https:\/\/rudelabs.ai\/blogs\/wp-content\/uploads\/2023\/07\/word-image-14903-1-1.webp\" alt=\"Bank Management System with C++\" width=\"396\" height=\"426\" \/><\/p>\n<h2><a id=\"post-14903-_heading=h.6y3o2vesvx3s\"><\/a>Conclusion<\/h2>\n<p>The Bank management system with C++ is a basic replica of logic for different operations that can be performed in a bank for opening accounts and managing the same by the customer. This project aids in learning how real-world systems can be modeled and implemented in C++ and demonstrates practical usage of file handling for data persistence.<\/p>\n<p><a href=\"https:\/\/rudelabs.ai\/blogs\/category\/c-computer-science\/\"><strong>More C++ Projects<\/strong><strong>&gt;<\/strong><strong>&gt;&gt;<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Bank management system deals with the concept of making a complete record of a customer\u2019s account.<\/p>\n","protected":false},"author":1,"featured_media":14904,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[16,4,7],"tags":[],"class_list":["post-14903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-computer-science","category-coding-basics","category-coding-projects"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Bank Management System with C++ - RUDE LABS<\/title>\n<meta name=\"description\" content=\"We have designed this Bank Management System with C++\u00a0 to simulate typical banking operations. It has been built to provide a hands-on experience with concepts of Object-Oriented Programming, file handling, and system design.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bank Management System with C++ - RUDE LABS\" \/>\n<meta property=\"og:description\" content=\"We have designed this Bank Management System with C++\u00a0 to simulate typical banking operations. It has been built to provide a hands-on experience with concepts of Object-Oriented Programming, file handling, and system design.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/\" \/>\n<meta property=\"og:site_name\" content=\"RUDE LABS\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T09:14:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-10T11:41:28+00:00\" \/>\n<meta name=\"author\" content=\"rudelabs.ai\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rudelabs_in\" \/>\n<meta name=\"twitter:site\" content=\"@rudelabs_in\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rudelabs.ai\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/\"},\"author\":{\"name\":\"rudelabs.ai\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#\/schema\/person\/560bad88bae03cae99a326a46af0c894\"},\"headline\":\"Bank Management System with C++\",\"datePublished\":\"2023-07-27T09:14:52+00:00\",\"dateModified\":\"2025-10-10T11:41:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/\"},\"wordCount\":1191,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#organization\"},\"image\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"C\/C++\",\"Coding Basics\",\"Coding Projects\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/\",\"url\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/\",\"name\":\"Bank Management System with C++ - RUDE LABS\",\"isPartOf\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2023-07-27T09:14:52+00:00\",\"dateModified\":\"2025-10-10T11:41:28+00:00\",\"description\":\"We have designed this Bank Management System with C++\u00a0 to simulate typical banking operations. It has been built to provide a hands-on experience with concepts of Object-Oriented Programming, file handling, and system design.\",\"breadcrumb\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rudelabs.ai\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bank Management System with C++\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#website\",\"url\":\"https:\/\/rudelabs.ai\/blogs\/\",\"name\":\"RUDE LABS\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/rudelabs.ai\/blogs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#organization\",\"name\":\"RUDE LABS\",\"url\":\"https:\/\/rudelabs.ai\/blogs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/rudelabs.ai\/blogs\/wp-content\/uploads\/2025\/09\/RUDE-LABS.webp\",\"contentUrl\":\"https:\/\/rudelabs.ai\/blogs\/wp-content\/uploads\/2025\/09\/RUDE-LABS.webp\",\"width\":2459,\"height\":414,\"caption\":\"RUDE LABS\"},\"image\":{\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/rudelabs_in\",\"https:\/\/www.linkedin.com\/company\/ru-delabs\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#\/schema\/person\/560bad88bae03cae99a326a46af0c894\",\"name\":\"rudelabs.ai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rudelabs.ai\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4d9f672e72f97294dfb6fac3d78e9f0bb5421a701cd2141cf2a2e540b4d67191?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4d9f672e72f97294dfb6fac3d78e9f0bb5421a701cd2141cf2a2e540b4d67191?s=96&d=mm&r=g\",\"caption\":\"rudelabs.ai\"},\"sameAs\":[\"https:\/\/rudelabs.ai\/blogs\"],\"url\":\"https:\/\/rudelabs.ai\/blogs\/author\/rudelabs-ai\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bank Management System with C++ - RUDE LABS","description":"We have designed this Bank Management System with C++\u00a0 to simulate typical banking operations. It has been built to provide a hands-on experience with concepts of Object-Oriented Programming, file handling, and system design.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/","og_locale":"en_US","og_type":"article","og_title":"Bank Management System with C++ - RUDE LABS","og_description":"We have designed this Bank Management System with C++\u00a0 to simulate typical banking operations. It has been built to provide a hands-on experience with concepts of Object-Oriented Programming, file handling, and system design.","og_url":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/","og_site_name":"RUDE LABS","article_published_time":"2023-07-27T09:14:52+00:00","article_modified_time":"2025-10-10T11:41:28+00:00","author":"rudelabs.ai","twitter_card":"summary_large_image","twitter_creator":"@rudelabs_in","twitter_site":"@rudelabs_in","twitter_misc":{"Written by":"rudelabs.ai","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#article","isPartOf":{"@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/"},"author":{"name":"rudelabs.ai","@id":"https:\/\/rudelabs.ai\/blogs\/#\/schema\/person\/560bad88bae03cae99a326a46af0c894"},"headline":"Bank Management System with C++","datePublished":"2023-07-27T09:14:52+00:00","dateModified":"2025-10-10T11:41:28+00:00","mainEntityOfPage":{"@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/"},"wordCount":1191,"commentCount":0,"publisher":{"@id":"https:\/\/rudelabs.ai\/blogs\/#organization"},"image":{"@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage"},"thumbnailUrl":"","articleSection":["C\/C++","Coding Basics","Coding Projects"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/","url":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/","name":"Bank Management System with C++ - RUDE LABS","isPartOf":{"@id":"https:\/\/rudelabs.ai\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage"},"image":{"@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage"},"thumbnailUrl":"","datePublished":"2023-07-27T09:14:52+00:00","dateModified":"2025-10-10T11:41:28+00:00","description":"We have designed this Bank Management System with C++\u00a0 to simulate typical banking operations. It has been built to provide a hands-on experience with concepts of Object-Oriented Programming, file handling, and system design.","breadcrumb":{"@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/rudelabs.ai\/blogs\/bank-management-system-with-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rudelabs.ai\/blogs\/"},{"@type":"ListItem","position":2,"name":"Bank Management System with C++"}]},{"@type":"WebSite","@id":"https:\/\/rudelabs.ai\/blogs\/#website","url":"https:\/\/rudelabs.ai\/blogs\/","name":"RUDE LABS","description":"","publisher":{"@id":"https:\/\/rudelabs.ai\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rudelabs.ai\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/rudelabs.ai\/blogs\/#organization","name":"RUDE LABS","url":"https:\/\/rudelabs.ai\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rudelabs.ai\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/rudelabs.ai\/blogs\/wp-content\/uploads\/2025\/09\/RUDE-LABS.webp","contentUrl":"https:\/\/rudelabs.ai\/blogs\/wp-content\/uploads\/2025\/09\/RUDE-LABS.webp","width":2459,"height":414,"caption":"RUDE LABS"},"image":{"@id":"https:\/\/rudelabs.ai\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/rudelabs_in","https:\/\/www.linkedin.com\/company\/ru-delabs\/"]},{"@type":"Person","@id":"https:\/\/rudelabs.ai\/blogs\/#\/schema\/person\/560bad88bae03cae99a326a46af0c894","name":"rudelabs.ai","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rudelabs.ai\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4d9f672e72f97294dfb6fac3d78e9f0bb5421a701cd2141cf2a2e540b4d67191?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d9f672e72f97294dfb6fac3d78e9f0bb5421a701cd2141cf2a2e540b4d67191?s=96&d=mm&r=g","caption":"rudelabs.ai"},"sameAs":["https:\/\/rudelabs.ai\/blogs"],"url":"https:\/\/rudelabs.ai\/blogs\/author\/rudelabs-ai\/"}]}},"_links":{"self":[{"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/posts\/14903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/comments?post=14903"}],"version-history":[{"count":2,"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/posts\/14903\/revisions"}],"predecessor-version":[{"id":17627,"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/posts\/14903\/revisions\/17627"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/media?parent=14903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/categories?post=14903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rudelabs.ai\/blogs\/wp-json\/wp\/v2\/tags?post=14903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}