/ * Implementation of class with primitive data members */
#include<iostream.h>
#include<conio.h>
class bank
{
char name[25],acctype[10];
int accno,tot;
float balance,withdraw;
public:
void data()
{
cout<<"\nEnter the Name of the customer:";
cin>>name;
cout<<"\nEnter the acc.type of the customer:";
cin>>acctype;
cout<<"\nEnter the acc.no of the customer:";
cin>>accno;
}
void bal()
{
cout<<"\nEnter the total amount in the acc:";
cin>>tot;
cout<<"\nEnter the amount to be withdraw:";
cin>>withdraw;
balance=tot-withdraw;
}
void display()
{
cout<<"\nDetails of the Customer\n";
cout<<"\n\tName of the customer:\t"<<name;
cout<<"\n\tAcc.Type:\t\t"<<acctype;
cout<<"\n\tAcc.No:\t\t\t"<<accno;
cout<<"\n\tTotal amount:\t"<<tot;
cout<<"\n\tWithdraw amount:\t"<<withdraw;
cout<<"\n\tBalance amount:\t\t"<<balance;
}
};
void main()
{
clrscr();
bank iob;
iob.data();
iob.bal();
iob.display();
getch();
}
Output:
Enter the Name of the customer: sivaraja
Enter the acc.type of the customer: SB
Enter the acc.no of the customer: 23743
Enter the total amount in the acc: 5600
Enter the amount to be withdraw: 3500.50
Details of the Customer
Name of the customer: sivaraja
Acc.Type: SB
Acc.No: 23743
Total amount: 5600
Withdraw amount: 3500.5
Balance amount: 2099.5
No comments:
Post a Comment