#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<iomanip.h>
class bank
{
private:
char name[20];
int ano;
char atype[3];
float balance;
public:
bank(){}
bank(char na[],int no,char type[],float bal)
{
strcpy(name,na);
ano=no;
strcpy(atype,type);
balance=bal;
}
void readdata()
{
cout<<endl<<"NAme : ";
cin>>name;
cout<<endl<<"Acc no :";
cin>>ano;
cout<<endl<<"acc type :";
cin>>atype;
cout<<endl<<"Balance : ";
cin>>balance;
}
void writedata()
{
cout<<endl<<setw(15)<<name<<setw(7)<<ano<<setw(9 )<<atype<<setw(15)<<balance;
}
~bank()
{
}
};
void main()
{
int n;
bank cust[' '],cust1("XYZ",1220,"SB",10000.00);
clrscr();
cout<<"Enter the num of cust :" ;
cin>>n;
for(int i=1;i<=n;i++)
cust[i].readdata();
clrscr();
cout.setf(ios::left,ios::adjustfield);
cout<<"\n \n Database for bank acc \n";
cout<<"Name num type bal ";
cust1.writedata();
for(i=1;i<=n;i++)
cust[i].writedata();
getch();
}
#include<conio.h>
#include<string.h>
#include<iomanip.h>
class bank
{
private:
char name[20];
int ano;
char atype[3];
float balance;
public:
bank(){}
bank(char na[],int no,char type[],float bal)
{
strcpy(name,na);
ano=no;
strcpy(atype,type);
balance=bal;
}
void readdata()
{
cout<<endl<<"NAme : ";
cin>>name;
cout<<endl<<"Acc no :";
cin>>ano;
cout<<endl<<"acc type :";
cin>>atype;
cout<<endl<<"Balance : ";
cin>>balance;
}
void writedata()
{
cout<<endl<<setw(15)<<name<<setw(7)<<ano<<setw(9 )<<atype<<setw(15)<<balance;
}
~bank()
{
}
};
void main()
{
int n;
bank cust[' '],cust1("XYZ",1220,"SB",10000.00);
clrscr();
cout<<"Enter the num of cust :" ;
cin>>n;
for(int i=1;i<=n;i++)
cust[i].readdata();
clrscr();
cout.setf(ios::left,ios::adjustfield);
cout<<"\n \n Database for bank acc \n";
cout<<"Name num type bal ";
cust1.writedata();
for(i=1;i<=n;i++)
cust[i].writedata();
getch();
}
No comments:
Post a Comment