//plz run .an accrued .Processor fault error.plz help me
/*
Bank taransection Program.cpp : Defines the entry point for the console application.
*/
#include "stdafx.h"
#include<iostream>
#include<string.h>
#include<string>
#include<process.h>
#include<conio.h>
using namespace std;
class details
{
public:
char *name;
int age;
char branch[50];
char city[40];
void getdetails()
{
name=new char[20];
cout<<endl<<endl<<"**********Customer Details*********** "<<endl;
cout<<" -------- ------- "<<endl;
cout<<"Enter Name: ";
cin>>name;
cout<<"Enter Age: ";
cin>>age;
cout<<"Enter Branch: ";
cin>>branch;
cout<<"Enter City: ";
cin>>city;
cout<<"______________________________________"<<endl<<endl;
}
};
class bank
{
public:
double accno;
static double accnumber;
long balance;
details d;
void getdata();
bank transfermoney(bank);
void deposit();
void withdrawal();
void newaccount();
void viewaccdetails();
};
//int bank::accno=0;
void main()
{
char ch;
static int i=0;
bank *a[10];
int x,amt,k,j;
system("cls");
do
{
cout<<endl<<endl<<"************MENU************"<<endl;
cout<<" ---- "<<endl;
cout<<"1.Create new account\n2.Deposit\n3.Withdraw\n4.Transfer credits\n5.View account details\n\n";
cout<<"Enter choice no.: ";
cin>>x;
switch(x)
{
case 1:
{
i++;
a[i]=new bank;
a[i]->newaccount();
break;
}
case 2:
{
cout<<"Enter account no.: ";
cin>>k;
a[k]->deposit();
break;
}
case 3:
{
cout<<"Enter account no.: ";
cin>>k;
a[k]->withdrawal();
break;
}
case 4:
{
cout<<"Enter the source and destination account nos.: ";
cin>>k>>j;
*a[j]=a[k]->transfermoney(*a[j]);
break;
}
case 5:
{
cout<<"Enter account no.: ";
cin>>k;
b.viewaccdetails();
break;
}
}cout<<"\nDo you wish to continue[Press 'Y' to continue or 'N' to exit menu]: ";
cin>>ch;
}while(ch=='y'||ch=='Y');
}
bank bank::transfermoney(bank a)
{
long amt;
cout<<"Enter amount to be transferred: ";
cin>>amt;
a.balance=a.balance+amt;
if(balance<amt)
{
cout<<"\nInsufficient balance! Operation Cannot be performed!"<<endl<<endl;
}
else
{
balance=balance-amt;
}
return a;
}
void bank::withdrawal()
{
long amtdrawn;
cout<<"Enter amount to be withdrawn: ";
cin>>amtdrawn;
if(balance<amtdrawn)
cout<<"\nInsufficient balance! Operation Cannot be performed!"<<endl<<endl;
else
balance=balance-amtdrawn;
}
void bank::deposit()
{
long dep;
cout<<"Enter amount to be deposited: ";
cin>>dep;
balance+=dep;
}
void bank::newaccount()
{
accno++;
d.getdetails();
balance=0;
}
void bank::viewaccdetails()
{
cout<<endl<<endl<<"*********ASSIGNMENT BANK ACCOUNT DETAILS*********"<<endl;
cout<<" --- ---- ------- ------- "<<endl;
cout<<"Account no.: "<<accno<<endl;
cout<<"Name: "<<d.name<<endl;
cout<<"Branch: "<<d.branch<<endl;
cout<<"City: "<<d.city<<endl;
cout<<"Current Balance: "<<balance<<endl;
cout<<"_________________________________________"<<endl;
}
HASHMI007
raptr_dflo 48 Posting Pro
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
pseudorandom21 166 Practically a Posting Shark
raptr_dflo 48 Posting Pro
HASHMI007
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.