sample program for handling dabase of a bank using class
here the program is just to give an overview of a bank database using class.object oriented programing is used to handle large database and when we have data in mass then we need to securly handle it . when we are talking about data then the first thing about which we are concerned is it's security and c++ provide this facility so this program is giving an overview that how database can be handled using c++ .
#include<iostream.h> //including header file
#include<conio.h>
class bank // defining class
{
int ac_name,w; // declairing data members
char name[20];
char ac_type[20];
int bal,add;
public:
void insert(); // declairing member function
void deposit();
void withdraw();
void display();
};
void bank:: insert() //defining memebr functions
{ bank b;
cout<<"enter your ac no.";
cin>>b.ac;
cout<<"enter your name";
cin>>b.name;
cout<<"enter your account type";
cin>>b.ac_type;
cout<<"enter the balance";
cin>>b.bal;
}
void bank::deposit()
{ bank b2;
cout<<"enter the amout to deposit";
cin>>b2.add;
b2.bal=b2.bal+b2.add;
}
void bank::withdraw()
{
bank b3;
//int x;
cout<<"enter the amount to withdarw";
cin>>b3.w;
b3.bal=b3.bal-b3.w;
}
void bank::display()
{
bank b4;
cout<<"the name and current balance of account is="<<b4.name<<endl<<b4.bal;
}
void main() //main part of the program
{ clrscr();
bank t1,t2,t3,t4;
t1.insert();
t2.deposit();
t3.withdraw();
t4.display();
}
#include<iostream.h> //including header file
#include<conio.h>
class bank // defining class
{
int ac_name,w; // declairing data members
char name[20];
char ac_type[20];
int bal,add;
public:
void insert(); // declairing member function
void deposit();
void withdraw();
void display();
};
void bank:: insert() //defining memebr functions
{ bank b;
cout<<"enter your ac no.";
cin>>b.ac;
cout<<"enter your name";
cin>>b.name;
cout<<"enter your account type";
cin>>b.ac_type;
cout<<"enter the balance";
cin>>b.bal;
}
void bank::deposit()
{ bank b2;
cout<<"enter the amout to deposit";
cin>>b2.add;
b2.bal=b2.bal+b2.add;
}
void bank::withdraw()
{
bank b3;
//int x;
cout<<"enter the amount to withdarw";
cin>>b3.w;
b3.bal=b3.bal-b3.w;
}
void bank::display()
{
bank b4;
cout<<"the name and current balance of account is="<<b4.name<<endl<<b4.bal;
}
void main() //main part of the program
{ clrscr();
bank t1,t2,t3,t4;
t1.insert();
t2.deposit();
t3.withdraw();
t4.display();
}
Comments
Post a Comment