Wednesday, 31 May 2017

Bank Management System in C++ [ source code ] free download

BANK MANAGEMENT SYSTEM PROJECT IN C++ 

watch Project Demo video on YouTube 

watch full c++ course in hindi / urdu for free on youtube

copy the below code in a text file and save it with .cpp extension 

------------------------------------------SOURCE CODE---------------------------------------------

/* ***********************************************************************
--------------------------------------------------------------------
PROJECT::: BANK MANAGEMENT SYSTEM
***************************************************************************
"  BSE 1A "
***************************************************************************

DEVELOPED BY: " SAAD ALI " AND  " JAMAL SABIR "
***************************************************************************

*/////////////////////////////////////////////////////////////////////////

#include<constream.h>
#include<stdio.h>
#include<string.h>
#include<graphics.h>
#include<dos.h>
int driver=DETECT,mode;
double zak=0;
///////////////////////logo/////////////////////////////////////////
void logo()
{    clrscr();
/*cout<<"\n\n\n\n\n\n\n\n\n\n\n\n";  textcolor(GREEN);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy/::::syyyyyyyyyys::::+yyyyo:::::::::::::::/+syyyyyy/::::yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    syyyyyyyyyyo    /yyyy/                  -syyyy.   `yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    syyyyyyyyyyo    /yyyy/    /oooooooo+-    /yyyy.   `yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    syyyyyyyyyyo    /yyyy/    +yyyyyyyyy+    /yyyy.   `yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    syyy+.......    /yyyy/    +yyyo----.   `/yyyyy.   `yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    sy+.            /yyyy/    +yo-         `-oyyyy.   `yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    ssooooooooo/    /yyyy/    +sooooooo+/`    oyyy.   `yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    syyyyyyyyyyo    /yyyy/    +yyyyyyyyyy:    /yyy.   `yyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyy-    syyyyyyyyyyo    /yyyy/    :++++++++/:    `syyy.    :::::::::::::os");delay(20);
cprintf("oyyyyyyyy-    syyyyyyyyyyo    /yyyy/                 `:syyyy.               :sys");delay(20);
cprintf("oyyyyyyyy+////yyyyyyyyyyys////oyyyyo///////////////+oyyyyyyy+//////////////syyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyys");delay(20);
cprintf("osssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss");delay(20);
delay(2000);*/
{
initgraph(&driver,&mode,"d://tcc3//bgi");
///////////////////////////-H-/////////////////////////
for(int i=0;i<21;i+=2)
{      setcolor(RED);
rectangle(100,100,100+i,200);
delay(50);
}
for(i=0;i<51;i+=2)
{
rectangle(121,140,121+i,160);
delay(50);
}
for(i=0;i<21;i+=2)
{
rectangle(171,100,171+i,200);
delay(50);
}
//////////////////////dot/////////////////////////////
for(int j=0;j<10;j+=2)
{
rectangle(211,191,211+j,200);
delay(30);
}
/////////////////////-B-///////////////////////////////
for(i=0;i<21;i+=2)
{ rectangle(251,100,251+i,200);
delay(30);}
for(i=0;i<35;i+=2)
{circle(281,124,i);
delay(30);
}
for(i=0;i<50;i+=2)
{circle(286,174,i);
delay(30);
}
for(i=0;i<10;i++)
{         setcolor(BLACK);
rectangle(251,89+i,320,99);
}
for(i=0;i<23;i++)
{         setcolor(BLACK);
rectangle(251,201+i,340,223);
}
for(i=0;i<20;i++)
{
rectangle(231,50,231+i,250);
}
for(i=0;i<15;i++)
{circle(286,174,i);
}
for(i=0;i<10;i++)
{circle(281,124,i);
}
///////////////////////dot///////////////////////////

for( j=0;j<10;j+=2)
{   setcolor(RED);
rectangle(355,191,355+j,200);
delay(30);
}
//////////////////////-L-////////////////////////////
for(i=0;i<21;i+=2)
{
rectangle(375,100,375+i,200);
delay(30);
}
for(i=0;i<51;i+=2)
{      setcolor(RED);
rectangle(396,180,396+i,200);
delay(50);
}
delay(2000);
}
}
///////////////////////////exit///////////////////////////
void exit()
{            closegraph();
/*outtextxy(240,230,"Processing..");delay(20);
outtextxy(240,230,"Processing....");        delay(20);
outtextxy(240,230,"Processing......");      delay(20);*/
clrscr();  int i;
initgraph(&driver,&mode,"d://tcc3//bgi");
setcolor(RED); int b=640;
outtextxy(270,220,"shutting down..");
for(i=1;i<=320;i++)
{  setfillstyle(SOLID_FILL,RED);
bar(1,480,i,1);
setcolor(BLACK);
outtextxy(i-40,220,"THANK ");
bar(640,1,b,480);
outtextxy(b+10,220,"YOU ");
delay(20); ;b--;
}
delay(2000);closegraph();
}
/////////////////////////////////////////////////////////////////////
///////////////////////////animated-menu function////////////////////////////
void menu()
{
initgraph(&driver,&mode,"");
outtextxy(275,116,"MAIN MENU");
setcolor(RED);
rectangle(260,100,360,130);
for(int i=100;i>=80;i--)
{    delay(5);
for(int j=150;j>=130;j--)
rectangle(270,i,350,j);
}
delay(10);
//////////////////////////////////////////////
for(i=200;i<=420;i++)
{ setcolor(BLACK);
outtextxy(240,196,"LOADING...");
setfillstyle(SOLID_FILL,RED);
bar(200,215,i,185);
delay(1);
}
outtextxy(240,196,"c..Creat account");
setcolor(GREEN);
rectangle(200,185,420,215);
     delay(1);
///////////////////////////////////////////////
for(i=200;i<=420;i++)
{ setcolor(BLACK);
outtextxy(240,230,"LOADING...");
setfillstyle(SOLID_FILL,RED);
bar(200,250,i,220);
delay(1);
}
outtextxy(240,230,"i..accounts info");
setcolor(WHITE);
rectangle(200,220,420,250);
delay(1);
///////////////////////////////////////////////
for(i=200;i<=420;i++)
{ setcolor(BLACK);
outtextxy(240,265,"LOADING...");
setfillstyle(SOLID_FILL,RED);
bar(200,285,i,255);
delay(1);
}
outtextxy(240,265,"s..accounts search");
setcolor(BLUE);
rectangle(200,255,420,285);  delay(1);
//////////////////////////////////////////////////
for(i=200;i<=420;i++)
{ setcolor(BLACK);
outtextxy(240,300,"LOADING...");
setfillstyle(SOLID_FILL,RED);
bar(200,320,i,290);
delay(1);
}
outtextxy(240,300,"z..zakat calculator");
setcolor(15);
rectangle(200,290,420,320);
  delay(1);
/////////////////////////////////////////
for(i=200;i<=420;i++)
{ setcolor(BLACK);
outtextxy(240,335,"LOADING...");
setfillstyle(SOLID_FILL,RED);
bar(200,355,i,325);
delay(1);
}
outtextxy(240,335,"d..delete account");
setcolor(5);
rectangle(200,325,420,355);
delay(1);
//////////////////////////////////////////
for(i=200;i<=420;i++)
{ setcolor(BLACK);
outtextxy(240,370,"LOADING...");
setfillstyle(SOLID_FILL,RED);
bar(200,390,i,360);
delay(1);
}
outtextxy(240,370,"t..transection");
setcolor(3);
rectangle(200,360,420,390);
delay(1);
////////////////////////////////////////////
for(i=200;i<=420;i++)
{ setcolor(BLACK);
outtextxy(240,410,"LOADING...");
setfillstyle(SOLID_FILL,RED);
bar(200,430,i,400);
delay(1);
}
outtextxy(240,410,"a..deposit");
setcolor(12);
rectangle(200,400,420,430);
delay(1);
////////////////////////////////////////////
for(i=200;i<=420;i++)
{ setfillstyle(3,RED);
outtextxy(240,445,"LOADING...");
bar(200,465,i,435);
delay(1);
}
outtextxy(240,445,"e..exit");
setcolor(14);
rectangle(200,435,420,465);
outtextxy(1,460,"r..reset");
outtextxy(1,450,"q..pay zakat");
}
///////////////////////////startup_animation/////////////////////////

void startup()
{         closegraph();
initgraph(&driver,&mode,"d://tcc3//bgi");
//outtextxy(240,230,"Processing..");delay(20);
//outtextxy(240,230,"Processing....");        delay(20);
//outtextxy(240,230,"Processing......");      delay(20);
clrscr();
setcolor(RED);
outtextxy(270,220,"STARTING UP..");
for(int u=0;u<3;u++)
{for(int k=270;k<=379;k++)
{setfillstyle(SOLID_FILL,BLACK);
bar(270,234,389,231);
rectangle(270,230,390,235);
setfillstyle(1,GREEN);
bar(k,234,k+10,231);
delay(5);
}}
delay(300);}
//////////////////////////non-animated menu///////////////////////////
void menu1()
{  closegraph();
initgraph(&driver,&mode,"d://tcc3//bgi");
outtextxy(275,116,"MAIN MENU");
setcolor(RED);
rectangle(260,100,360,130);
for(int i=100;i>=80;i--)
{
for(int j=150;j>=130;j--)
rectangle(270,i,350,j);
}
////////////////////////////////////////////////
setcolor(BLACK);
setfillstyle(SOLID_FILL,RED);
bar(200,215,420,185);
outtextxy(240,196,"c..Creat account");
setcolor(GREEN);
rectangle(200,185,420,215);
///////////////////////////////////////////////
setcolor(BLACK);
setfillstyle(SOLID_FILL,RED);
bar(200,250,420,220);
outtextxy(240,230,"i..accounts info");
setcolor(WHITE);
rectangle(200,220,420,250);

///////////////////////////////////////////////
setcolor(BLACK);
setfillstyle(SOLID_FILL,RED);
bar(200,285,420,255);
outtextxy(240,265,"s..accounts search");
setcolor(BLUE);
rectangle(200,255,420,285);
//////////////////////////////////////////////////
setcolor(BLACK);
setfillstyle(SOLID_FILL,RED);
bar(200,320,420,290);
outtextxy(240,300,"z..zakat calculator");
setcolor(15);
rectangle(200,290,420,320);

//////////////////////////////////////
setcolor(BLACK);
setfillstyle(SOLID_FILL,RED);
bar(200,355,420,325);
outtextxy(240,335,"d..delete account");
setcolor(5);
rectangle(200,325,420,355);
//////////////////////////////////////////
setcolor(BLACK);
setfillstyle(SOLID_FILL,RED);
bar(200,390,420,360);
outtextxy(240,370,"t..transection");
setcolor(3);
rectangle(200,360,420,390);

////////////////////////////////////////////
setcolor(BLACK);
setfillstyle(SOLID_FILL,RED);
bar(200,430,420,400);
outtextxy(240,410,"a..deposit");
setcolor(12);
rectangle(200,400,420,430);
////////////////////////////////////////////

setfillstyle(3,RED);
bar(200,465,420,435);

outtextxy(240,445,"e..exit");
setcolor(14);
rectangle(200,435,420,465);
outtextxy(1,460,"r..reset");
outtextxy(1,450,"q..pay zakat");

}
//////////////////////FUNCTIONS/////////////////////////////////////
void entry();
void add();
void show();
void search();
void del();
void zakat();
void trans();
void reset();
void zakat1();
void zakatran(long double a);
void reset1();
//////////////////////STRUCTURE/////////////////////////////////////
struct rec{
long double  id;
char name[30];
double sal;
char act[15];
}; struct rec temp;
/////////////////////////FILES/////////////////////////////////////
FILE *ptr;FILE *ptr1;
//////////////////////////MAIN//////////////////////////////////////
void main()
{clrscr(); int r=0; reset1();
logo();
////////////////////GRAPHICS MODULE////////////////////////////////
int /*x=170,*/i;
initgraph(&driver,&mode,"d:\\tcc3\\bgi");
startup();
closegraph(); clrscr();
initgraph(&driver,&mode,"d:\\tcc3\\bgi");

settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
setcolor(GREEN);
outtextxy(150,190,"       PLEASE WAIT");
settextstyle(8,0,2);
setcolor(YELLOW);
outtextxy(100,130,"     HIFAZAT BANK LIMITED");
cout<<"\n";
setcolor(5);
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
/*for(i=0;i<250;++i)
{
delay(30);
setcolor(RED);
line(x,200,x,220);
x++;}   */
//rectangle(170,215,470,230);
for(i=170;i<=470;i++)
{  setcolor(WHITE);
outtextxy(290,221,"LOADING..");
setfillstyle(8,RED);
bar(170,230,i,215);             delay(1);
}
char choice;
do{closegraph();
clrscr();
/*for(int l=1;l<3;++l){
for(int m=1;m<80;++m){
textcolor(m);
delay(10);
cprintf("±");}
cout<<"\n";} */
/////////////////menu call//////////////////
if(r==0)
menu();
else
menu1(); r++;
///////////////////CHOICE HANDLING/////////////////////////////////////////
choice=getch();
if (choice == 'c'){
/*for(int l=1;l<3;++l){
for(int m=1;m<70;++m){
textcolor(m);
delay(10);
cprintf("±±");}
cout<<"\n";}*/
entry(); }
else if (choice=='i')
show();
else if( choice=='s')
search();
else if(choice=='d')
del();
else if(choice=='z')
zakat();
else if(choice=='t')
trans();
else if(choice=='a')
add();
else if(choice=='r')
reset();
else if(choice=='q')
zakat1();
}while(choice!='e');
cout<<"\n";
/*for(i=1;i<3;++i){
for(int m=1;m<80;++m){
textcolor(m);
cprintf("±");
cprintf("±");
delay(6);}}*/
exit();
}           long double last=0;
////////////////DATA ENTRY MODULE//////////////////////////////////
void entry(){     closegraph();
clrscr();
ptr=fopen("data.dat","ab");
char ch='y';
while(ch=='y'){
clrscr();  x: cout<<"last id assigned: "<<last<<"\n\n";
cout<<"e";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"I";delay(20);cout<<".";delay(20);cout<<"D";delay(20);cout<<" (int only)";
cout<<"\n";
cin>>temp.id;
if(temp.id!=last+1)
{goto x;  }
last=temp.id;
//////////////////////////////////////////////////
//cout<<"account title\n";
cout<<"A";delay(20);cout<<"c";delay(20);cout<<"c";delay(20);
cout<<"o";delay(20);cout<<"u";delay(20);cout<<"n";delay(20);
cout<<"t";delay(20);cout<<" ";delay(20);cout<<"T";delay(20);
cout<<"i";delay(20);cout<<"t";delay(20);cout<<"l";delay(20);
cout<<"l";delay(20);cout<<"e";delay(20);cout<<" ";delay(20);
cout<<"\n";

///////////////////////////////////////////////////
gets(temp.act);
//cout<<"enter name\n";
cout<<"E";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"N";delay(20);cout<<"a";delay(20);cout<<"m";delay(20);
cout<<"e ";delay(20);cout<<"\n";

///////////////////////////////////////////
gets(temp.name);    z:
//cout<<"enter amount\n";
cout<<"e";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"A";delay(20);cout<<"m";delay(20);cout<<"o";delay(20);
cout<<"u";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<" ";delay(20);cout<<"\n";
////////////////////
cin>>temp.sal;
if(temp.sal<1)
{goto z;  }
fwrite(&temp,sizeof(temp),1,ptr);
cout<<"            enter n for exit and y for more\n";
ch=getch();}
fclose(ptr);
}
//////////////////DATA SHOW MODULE////////////////////////////////////
void show(){                   closegraph();
clrscr();
ptr=fopen("data.dat","rb");
cout<<"************************************************************\n";
cout<<" ID"<<"\t\t"<<"Name"<<"\t\t"<<"amount"<<"\t\t"<<"account_title"<<"\n";
cout<<"************************************************************\n";
while((fread(&temp,sizeof(temp),1,ptr))==1){
cout<<temp.id<<setw(10)<<setw(15)<<temp.name;cout<<setw(15)<<temp.sal<<setw(22)<<temp.act<<"\n";
cout<<"-------------------------------------------------------\n";
}
fclose(ptr);
getch();}
/////////////////SEARCH MODULE//////////////////////////////////////
void search(){         closegraph();
char ch='y'; if(last==0)
{ clrscr();
cout<<"no records in database.";
}              else {
do {
clrscr();
int flag=0;
ptr=fopen("data.dat","rb");
long double kid;      y:
cout<<"E";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"I";delay(20);cout<<".";delay(20);cout<<"D";delay(20);
cout<<" t";delay(20);cout<<"o";delay(20);cout<<" ";delay(20);
cout<<"B";delay(20);;cout<<"e";delay(20);cout<<" ";delay(20);
cout<<"S";delay(20);cout<<"e";delay(20);cout<<"a";delay(20);
cout<<"r";delay(20);cout<<"c";delay(20);cout<<"h";delay(20);
cout<<"e";delay(20);cout<<"d";delay(20) ;
cout<<"\n";

/////////////////////////////////////////////
cin>>kid;       if(kid<1||kid>last)
{cout<<"\nno such account id exist.\n\n";
goto y;}
else {
while((!flag)&&(fread(&temp,sizeof(temp),1,ptr))==1){
if(kid==temp.id)
{
 flag=1;}}
}
 if(flag==1){
cout<<"I.D : "<<temp.id<<"\n"<<"NAME : "<<temp.name<<"\n"<<"amount : "<<temp.sal<<"\n"<<"Account Title : "<<temp.act;

}
else  {
cout<<"R";delay(20);cout<<"e";delay(20);cout<<"c";delay(20);
cout<<"o";delay(20);cout<<"r";delay(20);cout<<"d";delay(20);
cout<<" ";delay(20);cout<<"N";delay(20);cout<<"o";delay(20);
cout<<"t";delay(20);cout<<" ";delay(20);cout<<"F";delay(20);
cout<<"o";delay(20);;cout<<"u";delay(20);cout<<"n";delay(20);
cout<<"d";delay(20);cout<<".";delay(20);cout<<".";delay(20);
cout<<".";


////////////////////////////////////////
}
fclose(ptr);
cout<<"\n\n\tSearch Another [y/n]";
ch=getch();
}while(ch!='n');     }
getch();
}
//////////////////DELETE MODULE////////////////////////////////

void del()
{ closegraph();
char ch='y';
if(last==0)
{ clrscr();
cout<<"no records in database.";
}              else {
do
{
clrscr();
long double a;       y:
cout<<"enter id to be delete: ";
cin>>a;
if(a<1||a>last)
{cout<<"\nno such account id exist.\n\n";
goto y;}
ptr=fopen("data.dat","rb");
ptr1=fopen("dummy.dat","wb");
while(fread(&temp,sizeof(temp),1,ptr)==1)
{
if(a!=temp.id)
fwrite(&temp,sizeof(temp),1,ptr1);
}
fclose(ptr1);
fclose(ptr);
ptr=fopen("data.dat","wb");
ptr1=fopen("dummy.dat","rb");
while(fread(&temp,sizeof(temp),1,ptr1)==1)
{
fwrite(&temp,sizeof(temp),1,ptr);
}
fclose(ptr);
fclose(ptr1) ;
cout<<"\n\n\tDelete Another [y/n]";
ch=getch();
}while(ch!='n');}
getch();

}
////////////////ZAKAT CALCULATOR/////////////////////////////////////
void zakat(){       closegraph();
char ch='y';
do{
clrscr();
for(int m=1;m<40;++m){
textcolor(m);
delay(3);
cprintf("±±");   }
cout<<"\n\n";

textcolor(WHITE);
double a;      cout<<"zakat collected: "<<zak<<"\n\n"; w:
cout<<"e";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"A";delay(20);cout<<"m";delay(20);cout<<"o";delay(20);
cout<<"u";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<" ";delay(20);
cout<<"\n";
cin>>a;
if(a<1)
{cout<<"negative ammount cannot be calculated\n\n";
goto w;}
cout<<"\n";
cout<<"T";delay(20);cout<<"h";delay(20);cout<<"e";delay(20);
cout<<" ";delay(20);cout<<"A";delay(20);cout<<"m";delay(20);
cout<<"o";delay(20);cout<<"u";delay(20);cout<<"n";delay(20);
cout<<"t";delay(20);cout<<" ";delay(20);cout<<"o";delay(20);
cout<<"f";delay(20);;cout<<" ";delay(20);cout<<"Z";delay(20);
cout<<"a";delay(20);cout<<"k";delay(20);cout<<"a";delay(20);
cout<<"t";delay(20);cout<<" ";delay(20);cout<<"i";delay(20);
cout<<"s";delay(20);;cout<<" ";delay(20);cout<<1*a/40<<" rupees";

////////////////////////////////////////////////////////////////////////
cout<<endl;
cout<<"\n\n \t Calculate Again [y/n]";
ch=getch();
}while(ch!='n');
getch();
}
///////////////////////TRANSECTION module////////////////////////////
void trans(){                    closegraph();
clrscr();
long double a; double x;
char ch='y';
if(last==0)
{ clrscr();
cout<<"no records in database.";
}              else {
do{
clrscr(); i:
cout<<"\nenter id of account: ";
cin>>a;
if(a<1||a>last)
{cout<<"\nenter valid id.\n";
goto i;}     o:
cout<<"\n\nentr amount of transections\n";
double kid;
cin>>kid;
if(kid<0)
{cout<<"\nenter positive ammount.";
goto o;}          int t=0;
ptr=fopen("data.dat","rb");
ptr1=fopen("dummy.dat","wb");
while(fread(&temp,sizeof(temp),1,ptr)==1)
{
//if(strcmp(a,temp.id)==1)
if(temp.id!=a)
fwrite(&temp,sizeof(temp),1,ptr1);
else {
if(temp.sal<kid)
{t=1; }
else
{x=temp.sal;
temp.sal-=kid;}
fwrite(&temp,sizeof(temp),1,ptr1); }
}
if(t==1)
cout<<"\n\nyou don't have enough balance";
fclose(ptr1);
fclose(ptr);
ptr=fopen("data.dat","wb");
ptr1=fopen("dummy.dat","rb");
//ptr=fopen("data.dat","ab");
//ptr1=fopen("dummy.dat","rb");
while(fread(&temp,sizeof(temp),1,ptr1)==1)
{
fwrite(&temp,sizeof(temp),1,ptr);
}



//////////////////////////////////////////////////////////

cout<<"-----------------------------------------------\n";
///////////////////////////////////////
 cout<<"P";delay(20);cout<<"r";delay(20);cout<<"e";delay(20);
cout<<"v";delay(20);cout<<"i";delay(20);cout<<"o";delay(20);
cout<<"u";delay(20);cout<<"s";delay(20);cout<<" ";delay(20);
cout<<"A";delay(20);cout<<"m";delay(20);cout<<"o";delay(20);
cout<<"u";delay(20);;cout<<"n";delay(20);cout<<"t";delay(20);
cout<<" ";delay(20);cout<<"=";delay(20);cout<<" ";delay(20);
cout<<x<<"\n";
if(t==0){
///////////////////////////////////
cout<<"-----------------------------------------------\n";
////////////////////////////////////////////////
   cout<<"A";delay(20);cout<<"f";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"T";delay(20);cout<<"r";delay(20);cout<<"a";delay(20);
cout<<"n";delay(20);cout<<"s";delay(20);cout<<"e";delay(20);
cout<<"c";delay(20);;cout<<"t";delay(20);cout<<"i";delay(20);
cout<<"o";delay(20);cout<<"n";delay(20);cout<<"  =";delay(20);

cout<<x-kid<<"\n";
//////////////////////////////////////////////
cout<<"-----------------------------------------------\n";
cout<<"\n-----------------------------------------------\n";
////////////////////////////////////////////////////
cout<<"T";delay(20);cout<<"r";delay(20);cout<<"a";delay(20);
cout<<"n";delay(20);cout<<"s";delay(20);cout<<"e";delay(20);
cout<<"c";delay(20);cout<<"t";delay(20);cout<<"i";delay(20);
cout<<"o";delay(20);cout<<"n";delay(20);cout<<" ";delay(20);
cout<<"S";delay(20);;cout<<"u";delay(20);cout<<"c";delay(20);
cout<<"c";delay(20);cout<<"e";delay(20);cout<<"ss";delay(20);
cout<<"f";delay(20);cout<<"u";delay(20);cout<<"ll.";delay(20);}
else cout<<"transection not successfull.";
///////////////////////////////////////////
cout<<"\n-----------------------------------------------\n";
cout<<"P";delay(20);cout<<"l";delay(20);cout<<"e";delay(20);
cout<<"a";delay(20);cout<<"s";delay(20);cout<<"e";delay(20);cout<<" ";delay(20);
cout<<"c";delay(20);cout<<"h";delay(20);cout<<"e";delay(20);
cout<<"c";delay(20);cout<<"k";delay(20);cout<<" ";delay(20);
cout<<"Y";delay(20);cout<<"o";delay(20);cout<<"u";delay(20);
cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"a";delay(20);cout<<"c";delay(20);cout<<"c";delay(20);
cout<<"o";delay(20);
cout<<"u";delay(20);;cout<<"n";delay(20);cout<<"t";delay(20);
///////////////////////////////////////////////
 fclose(ptr);
 fclose(ptr1);
 cout<<"\n\t Enter More [y/n]";
 ch=getch();
 }while(ch!='n'); }
 getch();
}
/////////////////////MONEY ADDING///////////////////////////////////
void add(){                                   closegraph();
clrscr();
long double a; double x,c;
char ch='y';
if(last==0)
{ clrscr();
cout<<"no records in database.";
}              else {
do{
clrscr(); r:
cout<<"enter id of account: ";
cin>>a;
if(a<1||a>last)
{ cout<<"\nenter valid account no.\n\n";
goto r;}   u:
cout<<"\nentr amount to be submit\n";
long int kid;
cin>>kid;
if(kid<0)
{ cout<<"\n\namount cannot ba transec here." ;
goto u;}
ptr=fopen("data.dat","rb");
ptr1=fopen("dummy.dat","wb");
while(fread(&temp,sizeof(temp),1,ptr)==1)
{
if(a!=temp.id)
fwrite(&temp,sizeof(temp),1,ptr1);
else if(a==temp.id){
x=temp.sal;
temp.sal= temp.sal+kid;
c=temp.sal;
fwrite(&temp,sizeof(temp),1,ptr1); }
}
fclose(ptr1);
fclose(ptr);
ptr=fopen("data.dat","wb");
ptr1=fopen("dummy.dat","rb");
while(fread(&temp,sizeof(temp),1,ptr1)==1)
{
fwrite(&temp,sizeof(temp),1,ptr);
}

cout<<"-----------------------------------------------\n";
///////////////////////////////////////
 cout<<"P";delay(20);cout<<"r";delay(20);cout<<"e";delay(20);
cout<<"v";delay(20);cout<<"i";delay(20);cout<<"o";delay(20);
cout<<"u";delay(20);cout<<"s";delay(20);cout<<" ";delay(20);
cout<<"A";delay(20);cout<<"m";delay(20);cout<<"o";delay(20);
cout<<"u";delay(20);;cout<<"n";delay(20);cout<<"t";delay(20);
cout<<" ";delay(20);cout<<"=";delay(20);cout<<" ";delay(20);
cout<<x<<"\n";

cout<<"C";delay(20);cout<<"u";delay(20);cout<<"r";delay(20);
cout<<"r";delay(20);cout<<"e";delay(20);cout<<"n";delay(20);
cout<<"t";delay(20);cout<<" ";delay(20);
cout<<"A";delay(20);cout<<"m";delay(20);cout<<"o";delay(20);
cout<<"u";delay(20);;cout<<"n";delay(20);cout<<"t";delay(20);
cout<<" ";delay(20);cout<<"=";delay(20);cout<<" ";delay(20);
cout<<c;

fclose(ptr1);
fclose(ptr);
cout<<"\n\n\t Enter Another[y/n]";
ch=getch();
}while(ch!='n'); }
getch();
}
/////////////////////////reset//////////////////////////////////////
void reset()
{    char ch;      cout<<"are you sure you want to reset to default: ";
cin>>ch;
if(ch=='y')
{ptr=fopen("data.dat","wb");
last=0;
fclose(ptr);}
else cout<<"ALL IS WELL";
}
/////////////////////////zakat payment////////////////////////////////////
void zakat1(){       closegraph();
clrscr();
for(int m=1;m<40;++m){
textcolor(m);
delay(3);
cprintf("±±");   }
cout<<"\n\n";
if(last==0)
{
cout<<"\n\nno account found";
}
else{
textcolor(WHITE);
long double a;   i:
cout<<"e";delay(20);cout<<"n";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"A";delay(20);cout<<"c";delay(20);cout<<"c";delay(20);
cout<<"o";delay(20);cout<<"un";delay(20);cout<<"t";delay(20);
cout<<" no ";delay(20);
cout<<"\n";
cin>>a;
if(a<1||a>last)
{cout<<"\nenter valid id.\n";
goto i;}
zakatran(a); }
////////////////////////////////////////////////////////////////////////
getch();
}
///////////////////////ZAKAT payment module////////////////////////////
void zakatran(long double a){    closegraph();
clrscr();
double x;
clrscr(); ///
int t=0;
double kid;
cout<<"\nenter golg price per tola: ";
double gold,s; cin>>gold;
s=gold*7.5;
ptr=fopen("data.dat","rb");
ptr1=fopen("dummy.dat","wb");
while(fread(&temp,sizeof(temp),1,ptr)==1)
{
//if(strcmp(a,temp.id)==1)
if(temp.id!=a)
fwrite(&temp,sizeof(temp),1,ptr1);
else {
if(temp.sal<s)
{t=1; }
else
{x=temp.sal;  kid=1*temp.sal/40;
temp.sal-=kid;}
fwrite(&temp,sizeof(temp),1,ptr1); }
}
fclose(ptr1);
fclose(ptr);
ptr=fopen("data.dat","wb");
ptr1=fopen("dummy.dat","rb");
//ptr=fopen("data.dat","ab");
//ptr1=fopen("dummy.dat","rb");
while(fread(&temp,sizeof(temp),1,ptr1)==1)
{
fwrite(&temp,sizeof(temp),1,ptr);
}



//////////////////////////////////////////////////////////
if(t==1){
cout<<"\nzakat is not payable on you.";
cout<<"\n-----------------------------------------------\n";
///////////////////////////////////////
 cout<<"\n\nzakat is only payable on account having "<<s<<" or greater balace.\n ";
 cout<<"\n\nzakat is on 7.5 tola gold or equalent ammount.";}
else {
///////////////////////////////////
cout<<"\n-----------------------------------------------\n";
cout<<"amount of zakat: "<<kid<<"\n\n"; zak+=kid;
////////////////////////////////////////////////
   cout<<"A";delay(20);cout<<"f";delay(20);cout<<"t";delay(20);
cout<<"e";delay(20);cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"T";delay(20);cout<<"r";delay(20);cout<<"a";delay(20);
cout<<"n";delay(20);cout<<"s";delay(20);cout<<"e";delay(20);
cout<<"c";delay(20);;cout<<"t";delay(20);cout<<"i";delay(20);
cout<<"o";delay(20);cout<<"n";delay(20);cout<<"  =";delay(20);

cout<<x-kid<<"\n";
//////////////////////////////////////////////
cout<<"-----------------------------------------------\n";
cout<<"\n-----------------------------------------------\n";
////////////////////////////////////////////////////
cout<<"z";delay(20);cout<<"a";delay(20);cout<<"k";delay(20);
cout<<"a";delay(20);cout<<"t";delay(20);cout<<" ";delay(20);
cout<<"p";delay(20);cout<<"a";delay(20);cout<<"y";delay(20);
cout<<"e";delay(20);cout<<"d";delay(20);cout<<" ";delay(20);
cout<<"S";delay(20);;cout<<"u";delay(20);cout<<"c";delay(20);
cout<<"c";delay(20);cout<<"e";delay(20);cout<<"ss";delay(20);
cout<<"fu";delay(20);cout<<"ll";delay(20);cout<<"y.";delay(20);}
cout<<"\nthank you";
///////////////////////////////////////////
cout<<"\n-----------------------------------------------\n";
cout<<"P";delay(20);cout<<"l";delay(20);cout<<"e";delay(20);
cout<<"a";delay(20);cout<<"s";delay(20);cout<<"e";delay(20);cout<<" ";delay(20);
cout<<"c";delay(20);cout<<"h";delay(20);cout<<"e";delay(20);
cout<<"c";delay(20);cout<<"k";delay(20);cout<<" ";delay(20);
cout<<"Y";delay(20);cout<<"o";delay(20);cout<<"u";delay(20);
cout<<"r";delay(20);cout<<" ";delay(20);
cout<<"a";delay(20);cout<<"c";delay(20);cout<<"c";delay(20);
cout<<"o";delay(20);
cout<<"u";delay(20);;cout<<"n";delay(20);cout<<"t";delay(20);
///////////////////////////////////////////////
 fclose(ptr);
 fclose(ptr1);
}

/////////////////////////////////////////////////////////////////

void reset1()
{   ptr=fopen("data.dat","wb");
fclose(ptr);
}
///////////////////////////thats all/////////////////////////////////////

1 comment: