CONTENTS
1. Introduction
2. Requirements
3. Implementation
4. Testing
5. Conclusion
INTRODUCTION
The Bank Management System is a console-based application designed to simulate basic
banking operations. It serves as a practical demonstration of how programming concepts in the
C language can be applied to solve real-world problems. This mini-project is ideal for beginners
to intermediate learners who want to enhance their skills in C programming and understand
how to implement structured and modular code.
The system focuses on providing essential banking functionalities, including creating customer
accounts, managing deposits and withdrawals, and viewing account details. The project
emphasizes the use of fundamental programming constructs such as file handling, data
structures, functions, loops, and conditional statements.
Objectives
1. To simulate basic banking operations such as account creation, deposit, withdrawal, and
balance inquiry.
2. To demonstrate the use of file handling for data storage and retrieval, ensuring persistent
data across sessions.
3. To implement user-friendly menus and interactive features to enhance the usability of the
application.
4. To explore modular programming by dividing the application into manageable functions.
Features of the System
1. Account Creation: Allows users to open a new bank account by providing basic details
such as name, account number, and initial deposit.
2. Deposit Money: Enables users to deposit money into their accounts and updates their
balance accordingly.
3. Withdraw Money: Facilitates withdrawal of money while ensuring sufficient balance in
the account.
4. Balance Inquiry: Displays the current balance and account details of a specific user.
5. Account Management: Allows viewing and modifying account details if required.
Technologies and Tools Used
Programming Language: C
Development Environment: GCC/Clang compiler, any IDE or text editor
Data Storage: File handling using .txt files for storing account information
REQUIREMENTS
1. Software Requirements
Programming Language: C
Compiler: GCC, Clang, or any C compiler (Code::Blocks, Dev-C++, Turbo C, etc.)
Integrated Development Environment (IDE): (Optional) Code::Blocks, Visual Studio
Code, or any text editor.
Operating System: Windows, macOS, or Linux.
2. Hardware Requirements
A computer with minimum specifications:
Processor: 1 GHz or faster
RAM: 2 GB or more
Storage: At least 100 MB free for storing source code and files
3. Functional Requirements
1. Account Management:
Create new accounts with details such as:
Account holder's name
Unique account number
Initial deposit amount
View account details of an individual user.
2. Transaction Management:
Deposit money into an account.
Withdraw money from an account (check for sufficient balance).
Display current account balance.
3. Data Persistence:
Store all account information in files (e.g., .txt files) for long-term data retention.
Read and update account details from the file during operations.
4. User Interface:
Provide a text-based menu system for user interaction.
Ensure ease of navigation and clear prompts for input.
5. Security Features:
Validate inputs such as account numbers and amounts.
Prevent invalid operations (e.g., withdrawing more than the balance).
4. Non-Functional Requirements
Performance:
The application should handle multiple accounts efficiently.
File operations (read/write) must be quick and error-free.
Scalability:
The design should allow easy extension to add features such as account deletion or loan
management.
Usability:
Clear instructions for all operations.
Error messages for invalid inputs or operations.
5. Tools and Libraries
Standard Libraries:
<stdio.h> for input/output operations.
<stdlib.h> for memory allocation and miscellaneous functions.
<string.h> for string manipulations.
<stdbool.h> for Boolean operations (optional).
File Handling:
Use file I/O functions (fopen, fclose, fprintf, fscanf, etc.) to manage account data.
This set of requirements ensures the project is well-defined, manageable, and achieves its
intended goals.
IMPLEMENTATION
The implementation of the Bank Management System in C involves breaking down the system
into modules, each handling a specific functionality. Here's how you can structure and
implement it:
1. System Modules
a. Main Menu
Display the options for users to choose from:
Create a new account
Deposit money
Withdraw money
View account details
Exit the application
Use a switch or if-else statement to navigate based on user input.
b. Account Creation
Collect account details:
Name
Account number (unique)
Initial deposit
Store the details in a file using file handling (fprintf or binary files).
Validate to ensure no duplicate account numbers.
c. Deposit Money
Accept the account number and the amount to deposit.
Search for the account in the file.
Update the balance and save the changes back to the file.
d. Withdraw Money
Accept the account number and the amount to withdraw.
Validate the balance to ensure sufficient funds.
Deduct the amount and update the file.
e. Balance Inquiry
Accept the account number from the user.
Search for the account in the file.
Display the account details, including the balance.
f. Data Storage
Use file handling for data persistence:
Store account details in a file (.txt or binary).
Use fopen, fclose, fprintf, and fscanf for text-based files.
Use fread and fwrite for binary files.
Maintain data in a structured format for easy retrieval and updates.
2. Key Functions
1. Main Function (main)
Calls other functions based on the user’s choice.
2. Account Creation Function (create_account)
Prompts the user for details and writes them to the file.
3. Deposit Function (deposit)
Reads the account file, updates the balance, and rewrites the file.
4. Withdraw Function (withdraw)
Similar to deposit, but with additional checks for sufficient balance.
5. Inquiry Function (inquire)
Searches for and displays account details.
6. Helper Functions search_account: Searches for an account by account number. update_file:
Updates account details in the file.
3. Additional Considerations
Error Handling:
Handle invalid inputs and file-related errors gracefully.
Show appropriate error messages.
Security Measures:
Mask sensitive inputs like PIN codes (if included).
Prevent invalid operations like over-withdrawing.
Extensibility:
Add features like account deletion, password protection, or interest calculation.
TESTING
SOURCE CODE :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Structure to store account details
struct Account { int
accountNumber; char name[50];
float balance;
};
// Function prototypes
void createAccount();
void depositMoney();
void withdrawMoney();
void viewAccount(); void
displayMenu();
int main() {
int choice;
while (1) { displayMenu();
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
createAccount();
break; case 2:
depositMoney();
break; case 3:
withdrawMoney();
break;
case 4:
viewAccount();
break; case 5:
printf("Exiting the program.\n");
exit(0);
break; default:
printf("Invalid choice. Please try again.\n");
return 0;
// Function to display the menu void displayMenu()
{ printf("\n--- Bank Management System ---\n");
printf("1. Create Account\n"); printf("2. Deposit
Money\n"); printf("3. Withdraw Money\n");
printf("4. View Account\n"); printf("5. Exit\n");
// Function to create a new account void
createAccount() {
FILE *file = fopen("accounts.dat", "ab");
struct Account newAccount;
if (file == NULL) {
printf("Error opening file.\n");
return;
printf("Enter account number: ");
scanf("%d", &newAccount.accountNumber);
printf("Enter name: ");
scanf(" %[^\n]", newAccount.name);
printf("Enter initial deposit: "); scanf("%f",
&newAccount.balance);
fwrite(&newAccount, sizeof(struct Account), 1, file);
fclose(file);
printf("Account created successfully!\n");
// Function to deposit money void
depositMoney() {
FILE *file = fopen("accounts.dat", "rb+");
struct Account account; int accountNumber;
float depositAmount; int found = 0;
if (file == NULL) {
printf("Error opening file.\n");
return;
printf("Enter account number: ");
scanf("%d", &accountNumber);
while (fread(&account, sizeof(struct Account), 1, file)) {
if (account.accountNumber == accountNumber) {
found = 1; printf("Enter
amount to deposit: "); scanf("%f",
&depositAmount); account.balance
+= depositAmount;
fseek(file, -sizeof(struct Account), SEEK_CUR);
fwrite(&account, sizeof(struct Account), 1, file);
printf("Deposit successful! New balance: %.2f\n", account.balance);
break;
if (!found) { printf("Account
not found.\n");
fclose(file);
}
// Function to withdraw money void
withdrawMoney() {
FILE *file = fopen("accounts.dat", "rb+");
struct Account account; int accountNumber;
float withdrawAmount; int found = 0;
if (file == NULL) {
printf("Error opening file.\n");
return;
printf("Enter account number: ");
scanf("%d", &accountNumber); while
(fread(&account, sizeof(struct Account), 1,
file)) { if (account.accountNumber ==
accountNumber) {
found = 1; printf("Enter amount
to withdraw: "); scanf("%f",
&withdrawAmount);
if (withdrawAmount > account.balance) {
printf("Insufficient balance.\n");
} else {
account.balance -= withdrawAmount;
fseek(file, -sizeof(struct Account), SEEK_CUR);
fwrite(&account, sizeof(struct Account), 1, file);
printf("Withdrawal successful! New balance: %.2f\n", account.balance);
break;
}
if (!found) { printf("Account
not found.\n");
fclose(file);
// Function to view account details void
viewAccount() {
FILE *file = fopen("accounts.dat", "rb");
struct Account account;
int accountNumber;
int found = 0;
if (file == NULL) {
printf("Error opening file.\n");
return;
printf("Enter account number: ");
scanf("%d", &accountNumber);
while (fread(&account, sizeof(struct Account), 1, file)) {
if (account.accountNumber == accountNumber) {
found = 1; printf("\n--- Account Details ---\n");
printf("Account Number: %d\n", account.accountNumber);
printf("Name: %s\n", account.name); printf("Balance: %.2f\n",
account.balance);
break;
}
if (!found) { printf("Account not
found.\n");
fclose(file);}
OUTPUTS :
…
Conclusion
The Bank Management System project serves as an excellent demonstration of
how programming concepts can be applied to solve real-world problems in the
banking domain. Through the implementation of this system, users can
efficiently manage essential banking operations such as account creation,
deposits, withdrawals, and balance inquiries.
This project highlights the importance of modular design, structured
programming, and the use of file handling for data persistence in C. It provides
learners with a practical understanding of how to develop interactive and
functional applications using the C programming language.
Moreover, this system is a foundational step toward building more complex and
featurerich applications in the future. With additional features like account
deletion, password protection, transaction history, or integrating a database, this
project can be scaled to simulate a fully-fledged banking application.
Overall, the Bank Management System not only enhances coding skills but
also encourages problem-solving, logical thinking, and the ability to design
user-friendly systems that can have practical applications in everyday life.