Department of Polymer
Department of Polymer
ANSWER
This program in C makes it possible for the complete operations of a general
banking system. Users create a new account, enter an existing one or end the
session using provided main menu. The account creation feature verifies user IDs
and protects them while storing their passwords with zero initial account balances.
When a user logs onto the system, he is presented with an account menu
containing options such as withdrawing money provided one’s balance is adequate,
depositing money, and checking one’s balance. The program allows several logins,
and after attempting to log in several times without success, the participant is sent
to the main menu. This session is notable since it illustrates the basic features of
banking services in C as well – error handling and program structure.
IMPLIMENTATION OF CODE
#include <stdio.h>
#include <string.h>
// Function prototypes
void createAccount(Account *accounts, int *numAccounts);
void login(Account *accounts, int numAccounts);
void deposit(Account *account);
void withdraw(Account *account);
void requestBalance(Account *account);
int main() {
Account accounts[100]; // Maximum 100 accounts
int numAccounts = 0;
int choice;
while (1) {
printf("Mr. Abc ATM Machine!\n");
printf("1. Login\n");
printf("2. Create New Account\n");
printf("3. Quit\n");
printf("Enter choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
login(accounts, numAccounts);
break;
case 2:
createAccount(accounts, &numAccounts);
break;
case 3:
printf("Thanks for stopping by!\n");
return 0;
default:
printf("Invalid choice. Please try again.\n");
}
}
return 0;
}
switch (choice) {
case 1:
deposit(&accounts[i]);
break;
case 2:
withdraw(&accounts[i]);
break;
case 3:
requestBalance(&accounts[i]);
break;
case 4:
return;
default:
printf("Invalid choice. Please try again.\n");
}
}
}
}
printf("Login failed!\n");
}
Conclusion
To sum up, this C program presents a simple and basic but working C program that
illustrates basic concepts in programming such as structures, login, and menus.
Considering account opening and login securely, the performing of primary
banking transactions such as deposit, withdrawal, and balance inquiries, this
program is able to emulate the functions of a bank. Because the program is
designed in a modular fashion, it is organized, easy to maintain, and easy to use.
This is a good case to illustrate how C can be used to develop software in practice.