Program to define a class to represnt a bank account including name of depositer, acc. number, type of account,balance in C++
#include<iostream.h>
#include<conio.h>
class bank
{
int accno;
char name[20];
float bal;
char type[10];
public:
void getdata()
{
cout<<"\n\nEnter Account Number :: ";
cin>>accno;
cout<<"\nEnter Customer Name :: ";
cin>>name;
cout<<"\nEnter Account Balance :: ";
cin>>bal;
cout<<"\nEnter Account Type :: ";
cin>>type;
}
void putdata()
{
cout<<"\n\n\t\tAccount's Info ";
cout<<"\nAccount Number :: "<<accno;
cout<<"\nCustomer Name :: "<<name;
cout<<"\nAccount Balance :: "<<bal;
cout<<"\nAccount Type :: "<<type;
}
};
void main()
{
clrscr();
bank b;
b.getdata();
b.putdata();
getch();
}
OUTPUT
Enter Account Number :: 23456
Enter Customer Name :: Abcd
Enter Account Balance :: 10000
Enter Account Type :: Saving
Account's Info
Account Number :: 23456
Customer Name :: Abcd
Account Balance :: 10000
Account Type :: Saving