C++ bank account program
Bank account program in C++ using the classes, objects, data members, and member functions.
Data members of the class
Name of the depositor.
Account number of the account holder.
Type of bank account
Total Balance amount in the bank account of the account holder.
Member functions of the class
To assign initial values.
To deposit an amount in the account.
To withdraw an amount after checking the balance from the bank account
To display the name and balance of the account holder.
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 | #include<iostream> #include<stdio.h> #include<string.h> using namespace std; class T4Tutorials { int acno; char AccountHolderName[100], Account_Type[100]; float bal; public: T4Tutorials(int acc_no, char *name, char *acc_type, float Balance) //Parameterized Constructor { acno=acc_no; strcpy(AccountHolderName, name); strcpy(Account_Type, acc_type); bal=Balance; } void deposit(); void withdraw(); void Show(); }; void T4Tutorials::deposit() //depositing an amount { int DepositAmmount1; cout<<" Enter Deposit Amount = "<<endl; cin>>DepositAmmount1; bal+=DepositAmmount1; } void T4Tutorials::withdraw() //withdrawing an amount { int WithdrawAmmount1; cout<<" Enter Withdraw Amount = "<<endl; cin>>WithdrawAmmount1; if(WithdrawAmmount1>bal) cout<<" Cannot Withdraw Amount"<<endl; bal-=WithdrawAmmount1; } void T4Tutorials::Show() //Showing the details { cout<<" *************"<<endl; cout<<" Accout No. : "<<acno; cout<<" Name : "<<AccountHolderName; cout<<" Account Type : "<<Account_Type; cout<<" Balance : "<<bal; } int main() { int acc_no; char name[100], acc_type[100]; float Balance; cout<<" Enter Details: "<<endl; cout<<"***********"<<endl; cout<<" Accout No. "<<endl; cin>>acc_no; cout<<" Name : "<<endl; cin>>name; cout<<" Account Type : "<<endl; cin>>acc_type; cout<<" Balance : "<<endl; cin>>Balance; T4Tutorials b1(acc_no, name, acc_type, Balance); //object is created b1.deposit(); // b1.withdraw(); // calling member functions b1.Show(); // return 0; } |
Output
Bank Management System Project in C++
Covered
- Bank account details program in c++.
- C++ program for a bank account using class.
- Program for a bank account in c++.
- C++ program to manage a bank account using classes and objects.
- Program to create bank account in c++.