Javatpoint Logo
Javatpoint Logo

Banking Account System in C using File handling

With the help of file handling, we can create a local banking account system on our computer which can have functionality like account opening, account login, transaction etc.

In the main function, we will have all the features that based on user input. We will call different functions from the main functions.

Here, we implement four functions majorly:

  1. AccountCreation()
    This function will take user details as the input, and it will create a new account for the user with the proper username and password.
    We will create a structure data type to store all the details, and then we will store these details into a text file which will be named by the username.
  2. CheckBalance()
    This function will be used to check current of money in the account which is logged in. We will check all the files, and for the file which will match the user name and password, we will display its bank account balance.
  3. SendMoney()
    This function will be used to send money from one account to another account.
    With the help of file handling, we will open the file of the user to whom we want to send the money to and then we will write the amount of money, and we will subtract the amount of money from the sender's file.
  4. LogIn()
    This function will be used to log in to the account with a username and password that already exists. For this feature, we will open all the files and search for the user name that exists entered by the user, and if the password is correct, then we will be logged into that account.

C Example:

Output:

Banking Account System in C using File handling

Explanation:

In the above code, we have the main display where we currently have options to choose the functionality.

  • Let's suppose we have clicked 1. Then we will be entering into creating a new account section.
  • Now, we will have to enter all the details like name and father's name, mother's name, phone number, aadhar number etc.
  • Then, these details will be stored in a struct variable where we will store these details in the file in text format.
  • We will enter one username and password for the account, and the file name will be username.txt.
  • Now, if we choose the second option, we will be asked for the username and password. When we enter the username and password, it will check all the files in our system folder and search for the username and password exist or not. If they exist, then it opens the text file and displays it on the screen.
  • If we click on transfer money then we will enter sender and receiver's account and it will add the money in the receivers' bank account file.
  • In the same way, we can log out or exit from any account we logged in.






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA