0% found this document useful (0 votes)
38 views

Simple Bank Problem

This C++ program implements a simple bank management system that allows users to input customer details including name, account type, number and balance. It provides functions to deposit, withdraw and display account balances. The main function prompts the user to enter an account number and then offers menu options to perform transactions on that account by calling the relevant class functions.

Uploaded by

Sameer
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Simple Bank Problem

This C++ program implements a simple bank management system that allows users to input customer details including name, account type, number and balance. It provides functions to deposit, withdraw and display account balances. The main function prompts the user to enter an account number and then offers menu options to perform transactions on that account by calling the relevant class functions.

Uploaded by

Sameer
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

C++ program for simple bank management:

#include<iostream>

#include<stdlib.h>

using namespace std;

class accountdetails

char name[30],acc_type[20];

public:

int acc_no,acc_bal,amount;

public:

void input()

cout<<"Enter name,account type,account number & account balance\n";

cin>>name>>acc_type>>acc_no>>acc_bal;

void deposite()

cout<<"Enter the amount to be credited in the account\n";

cin>>amount;

acc_bal=acc_bal+amount;

void withdraw()

cout<<"Enter the amount that has to be debited\n";

cin>>amount;

if(amount<=acc_bal)

cout<<"debited amount= "<<amount<<endl;

acc_bal=acc_bal-amount;

cout<<"available balance= "<<acc_bal<<endl;

}
else

cout<<"Your account does not have sufficient balance\n";

void display()

cout<<"Name= "<<name<<endl;

cout<<"Account number= "<<acc_no<<endl;

cout<<"Type of account= "<<acc_type<<endl;

cout<<"balance= "<<acc_bal<<endl;

};

int main()

int i,ch,n;

accountdetails c[5];

for(i=0;i<5;i++)

cout<<"Input details of customer"<<(i+1)<<endl;

c[i].input();

cout<<"Enter your account number:";

cin>>n;

for(i=0;i<5;i++)

if(c[i].acc_no==n)

while(1)

{
cout<<"Enter 1 for credit amount\n Enter 2 for debit amount \n Enter 3 for display the
details\nEnter 4 for exit\n";

cout<<"Enter your choice: ";

cin>>ch;

switch(ch)

case 1:

c[i].deposite();

break;

case 2:

c[i].withdraw();

break;

case 3:

c[i].display();

break;

case 4:

exit(0);

default:

cout<<"Wrong choice entered";

if(i==5)

cout<<"No data found";

You might also like