C++ Project – Bank Management System Project with Source Code

Free C++ course with real-time projects Start Now!!

Program 1

// Banking Application System in CPP
#include<iostream>
#include<stdio.h>
#include<conio.h>
#define clrscr() system("cls")
using namespace std;
class Bank
{
    int amount;
    public:
    Bank()
    {
        amount=0;
    }
    void deposit(int amt);
    void withd(int amt);
    void balance();
};
void Bank::deposit(int amt)
{
    if(amt<0)
      cout<<"Invalid amount";
    amount=amount+amt;
}
void Bank::withd(int amt)
{
   if(amt<0)
      cout<<"Invalid amount";

    if(amt>amount)
        cout<<"\nInsufficient balance.. pls check";
    else
    {
        amount=amount-amt;
    }
}
void Bank::balance()
{
    cout<<"\n Your current balance: "<<amount;
}
int main()
{
   char ch1,ch2,ch3,ch4;
   int count=4;
     clrscr();
   while(count!=0)  
  { 
    cout<<"\nEnter pin: ";
    ch1=getch();
    cout<<"*";
    ch2=getch();
    cout<<"*";
    ch3=getch();
    cout<<"*";
    ch4=getch();
    cout<<"*";
    if(ch1=='1' && ch2=='2' && ch3=='3' && ch4=='4')
      break;
      else
    count--;
    cout<<"\nInvalid pin: only "<<count<<" options remaing";
  }  
  if(count==0)
  {
      cout<<"\nYour account is block for 24 hours: pls contact in your Bank Branch...";
  }

if(ch1=='1' && ch2=='2' && ch3=='3' && ch4=='4')
{
    int choice,myamt;
     Bank B;
    clrscr();
  do
  {
    cout<<"\n-----------------Bank Application--------------------";
    cout<<"\n1. Deposit";
    cout<<"\n2. WithDrawal";
    cout<<"\n3. Check Balance";
    cout<<"\n4.Exit";
    cout<<"\n--------------------------------------------------------";
    cout<<"\nEnter your choice: ";
   cin>>choice;
  
   switch(choice)
   {
     case 1: 
     {
        cout<<"\nEnter amount for depoist: ";
        cin>>myamt;
        B.deposit(myamt);
        break;
     }
     case 2: 
     {
        cout<<"\nEnter amount for withdrawal: ";
        cin>>myamt;
        B.withd(myamt);
        break;
     }
     case 3:B.balance();
   }
  }while(choice!=4);
}
else
cout<<"Invalid pin";
}

 

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *