Void Main (Int GD DETCT, GM FILE Stream

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 30

#include <stdio.

h>
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <dos.h>
#include <string.h>
#include <alloc.h>
struct sbi
{
int n;
char pass[10];
float inter, fix;
}bank;
void titlebar()
{
setcolor(BLUE);
settextstyle(0,0,6);
outtextxy(30,30,"SBI");
setcolor(6);
settextstyle(0,0,2);
outtextxy(200,30,"State Bank Of India");
setcolor(7);
settextstyle(0,0,1);
outtextxy(230,50,"lamington road, Mumbai");
outtextxy(270,65,"Pin code : 4510001");
line(100,100,500,100);
}
void show()
{
Int x;
setcolor(BLUE);
for(x=300;x<=590;x++)
{
rectangle(300,420,x,445);
sound(100);
delay(10);
nosound();
}
}

void main()
{
int gd=DETCT,gm;
FILE *stream;
initgraph(&gd,&gm," ");
clrscr();
cleardevice();
titlebar();
bank.n=1;

gotoxy(12,15);
printf("Enter the Interest Rate \t: ");
scanf("%s",&bank.Inter);

gotoxy(12,17);
printf("Enter fixed Amount \t: ");
scanf("%f",&bank.fix);
gotoxy(12,19);
printf("Enter the Bank Password \t: ");

scanf("%s",&bank.pass);
if (( stream= fopen("Sbi.sbi", "wb")) == NULL)
{
clrscr();
cleardevice();
gotoxy(16,15);
printf(Cannot Write output file.");
delay(200);
}
else
{
fwrite(&bank, sizeof(bank), 1, stream);
fclose(stream);
gotoxy(15,28);
setcolor(YELLOW);
rectangle(100,417,600,448);
printf("Saving . . .");
show();
}
exit(0);
getch();
}
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <dos.h>
#include <string.h>
#include <alloc.h>

void closewin();
void show2();
void check();
void settings();
void tran();
void form1();
void vochers();
void display();
void about();
void export();
void modacc();
void adddepo();
void close();
void bankdisplay();
void main();
void help();
int sd,sm,sy;
struct sbi
{
int n;
char pass[10];
float inter,fix;
}bank;
struct atm
{
float accno;

char name[30];
int age,sd,sm,sy;
char sex[5];
char stat[10];
}card;
struct acc
{
float accno;
char name[30 ],accpass[25],address[101],city[25];
float fix, ppno, balance;
char stat[5];
}account;
void tinreat(int x,int y, int p, int q, int t)
{
int i;
setcolor(RED);
for(i=1;i<=t;i++)
{
rectangle(p,q,x+i,y+i);
delay(100);
}
}
void titlebar()
{
setcolor(BLUE);
settextstyle(0,0,6);
outtextxy(30,30,"SBI");
setcolor(6);
settextstyle(0,0,2);
outtextxy (200,30,"State Bank Of India");
setcolor(7);
settextstyle(0,0,1);
outtextxy(230,50,"Chinakada Road ,Kerala , Kollam");
outtextxy(270,65,"Pin code : 691001");
line(100,100,500,100);
}
void show1()
{
int i,j;
setcolor(2);
for(i=10;i<=450;i=i+5)
{
circle(10,i,5);
circle(620,i,5);
delay(10);
}
for (i=10;i<=620;i=i+5)
{
circle(i,10,5);
circle(i,450,5);
delay(10);
}
show2();
}
void show2()
{
int i,j;
setcolor(7);
settextstyle(0,0,6); for
(i=250;i>=30;i- -)
{

setcolor(BLUE);
outtextxy(i,i,"SBI");
setcolor(BLACK);
o utx tx y( i ,i, "S BI ") ;
delay(5);
}
setcolor(BLUE);
outtextxy(i,i,"SBI");
setcolor(6);
settextstyle(0,0,2);
outtextxy(200,30,"State Bank Of India");
setcolor(7);
settextstyle(0,0,1);
outtextxy(230,50,"Chinakada Road ,Kerala , Kollam");
outtextxy(270,65,"Pin code : 691001");
for(i=0;i<=400;i++)

{
line(100,100,100+i,100);
del ay( 10) ;
}
}
void help()
{
int i,j;
clrscr();
cleardevice();
titlebar();
setcolor(i);
sound(100);
settextstyle(0,0,2);
outtextxy(80,150,"Help Menu");

gotoxy( 10,12);
printf("\ t This a very GUI freindly Banking Accounting Software.Follwing are key cases used to data insert
and modifys");
printf(\n\n1.Account\n\n\t Create, edit, close an Account are contain this property ");
printf(\n2.Dis pla y\n\n\tBank Balance,Account Information,About Me as are contain this property ");
printf("\n3.Settings\n\n\tChage Password,Change Interest Rate as on Bank property ");
printf("\n4.Transaction\n\n\t Add Deposite,Re Audit an Accounts amount contain this property ");
printf("\n5.Exit.\n\n\tThis contain exit SBI Account property or Quit the software. ");
delay(800);
nosound();
} settings();}
void addform()
{
int n,i,age,sd,sm,sy;
char name[30],c[4],address[100],stat[5],sex[5],city[25],pass[25]; float
fix,balance,ppno;
struct date d;
FILE *stream;
getdate(&d);
sd = d.da_day ;
sm = d.da_mon ;
sy = d.da_year ;
n=bank.n;
clrscr();
cleardevice();
titlebar();
setcolor(YELLOW);
rectangle(50,150,600,450);
line(50,200,600,200);
line(50,230,600,230);
line(50,260,600,260);

line(50,290,600,290);

line(50,325,600,325);
line(50,370,600,370);

gotoxy(9,12);
printf("Account Number
printf("%d",n+1000);

:");

gotoxy(40,12);
printf("Opening Date
:");
%
printf("%d- d-%d",sd,sm,sy);

gotoxy(9,14);
printf("Account Name
scanf("%s",&name);

:");

gotoxy(9,16);
printf("Age
:");
scanf("%d",&age);

gotoxy(40,16);
printf("Sex (Male/Female) :");
scanf("%s",&sex);

gotoxy(9,18);
printf("Adress :");
scanf("%s",&address);

gotoxy(9,20);
printf("City :");
scanf("%s",city);

gotoxy(40,20);
printf("\7Account Password :");
scanf("%s",pass);

gotoxy(9,22);
printf("Depocite Amount
scanf("%f",&balance);
if(balance<bank.fix)

:");

{
gotoxy(9,30);
printf("Fixed Amount is Low.Minimum Amount is %f",bank.fix);

}
gotoxy(40,22);
printf("Passport Number
scanf("%f",&ppno);

:");

gotoxy(9,25);
printf("Do you Want to Save This Account (y/n) :");
scanf("%s",&c);
if((strcmp(c,"y")==0) | | (strcmp(c,"Y")==0))
{
line(50,410,600,410);
gotoxy(9,28); printf("Saving . .
."); setcolor(BLUE);
card.accno=n+1000;
account.accno=n+1000;
(card.name,name);
card.age=age;
strcpy(card.sex,sex);
strcpy(account.address,address);
strcpy(account.city,city);
strcpy(card.stat,"Open");
account.ppno=ppno;
card.sd=sd;
card.sm=sm;
card.sy=sy;
account.accno=n+1000;
strcpy(account.name,name);
strcpy(account.accpass,pass);
account.fix=bank.fix;
account.balance=balance;
strcpy(account.stat,"Open");

export();
stream=fopen("sbiacc.sbi","a+b");
f wr i t e ( ( c h a r * ) & a c c o u n t , 1 , s i z e o f ( a c c o u n t ) , s t r e a m ) ;
fclose(stream);
bank.n=n+1;
for(i=300;i<=590;i++)
{
rectangle(300,420,i,440);
delay(10);
} clrscr();
cleardevice();
titlebar();
vochers();
} else
{
clrscr();
cleardevice();
titlebar();
vochers();
}
}
void accview()
{
float no;
int n,i,fact;
float balance; FILE
*stream; clrscr();
cleardevice(); titlebar();
stream=fopen("Sbiacc.sbi","r+b");

gotoxy(25,15);
printf("Enter Account Number: ");
scanf("%f",&no);
n=bank.n; for(i=1;i<n;i++)
{
fread(&account,sizeof(account),1,stream);
if(account.accno==no)
{
fact=l;
break;
} else
{
fact=0;
}
if(fact==1)
{
clrscr();
cleardevice();
titlebar();
setcolor(YELLOW);
rectangle(50,150,600,450);

gotoxy(9,14);
printf("Acount Number

:%f",account.accno);

gotoxy(9,16);
printf("Account Name

:%s",account.name);

gotoxy(9,18);
printf("Account Standard :%s",account.stat);

gotoxy(9,20);
printf("Passport Number

:%f",account.ppno);

gotoxy(9,22);
printf ("Address

:%s",account.address);

gotoxy(9,24);
printf ("City

:%s",account.city);

gotoxy(9,26);
printf("Balance Amount :%f",account.balance);
delay(1000);
for(i=0;i<=10;i++)
{
setcolor(i);
sound(100);
settextstyle(0,0,2);
outtextxy(80,170,"Account View");
delay(300);
nosound();
}
fclose(stream);
clrscr();
cleardevice();
titlebar();
display();
}

else
{
clrscr();
cleardevice();

gotoxy(25,25);
titlebar();
setcolor(RED);

settextstyle(1,0,1);
outtextxy(400,250, "Account Number Wrong");
adddepo();
}
}
void display()
{
int i;
clrscr();
cleardevice();
titlebar();
gotoxy(27,10);
printf("Menu Bar - Display");
gotoxy(25,13);
printf(" 1. Bank Balance");
gotoxy(25,15);
printf(" 2 . Account View");
gotoxy(25,17);
printf(" 3 . About Me"); gotoxy(25,19);
printf(" 4 . Go Back");
setcolor(YELLOW);
rectangle(175,130,375,380);
line(175,160,375,160);
line(175,165,375,165);
line(175,340,375,340); gotoxy(23,23);
printf(" Enter your choice :");
scanf("%d",&i);
switch(i)
{ case 1:
bankdisplay();
break; case 2:
accview();
break; case 3:
about();
break; case 4:
clrscr();
cleardevice();
titlebar();
form1();

break; default:

gotoxy(25,25);
printf("\7Wrong Decision");
delay(300);
display();
break;
};
}
void bankdisplay()
{
int i=1,n;
float a=0;
FILE *stream;
clrscr();
cleardevice();
stream=fopen("Sbiacc.sbi","r+b");
titlebar();

gotoxy(1,12);
printf("Sl No\t Account No \t\t Customer Name \t\t\t Balance");
printf("\n\n ------------------------------------------------------------------------------- );
n=bank.n;
for(i=1;i<n;i++)
{
fread(&account,sizeof(account),1,stream);
printf("\n%2d \t%f %20s \t\t %10f ",i,account.accno,account.name,account.balance);
a=a+account.balance;
}
fclose(stream);
printf("\n\n----------------------------------------------------------------------- );
p\n\t\t\t\trintf(" Bank Balance : %f",a);
printf("\n\n----------------------------------------------------------------------- );
delay(7000);
form1();
}
void a d e p o ( )
{
float no;
int n,i,fact,ca; float
balance; FILE *stream;
clrscr(); cleardevice();
titlebar();
stream=fopen("Sbiacc.sbi","r+b");

gotoxy(25,15);
printf("Enter Account Number: ");
scanf("%f",&no);
n=bank.n;
for(i=1;i<n;i++)
{
fread(&account,sizeof(account),1,stream);
if ((account.accno==no)&&(strcmp(account.stat,"Open")==0))
{
fact=1; ca=i;
break;
} else
fact=0;
}
if(fact==1)
{
clrscr(); cleardevice();
titlebar();
setcolor(YELLOW);
rectangle(50,150,600,350);
fseek(stream,(long)((ca-l)*sizeof(account)),0);

gotoxy(9,14);
printf("Acount Number

:%f",account.accno);

gotoxy(9,16);
printf("Account Name

:%s",account.name);

gotoxy(9,18);
printf("Deposited Amount :");
scanf("%f",&balance);
account.balance=account.balance+balance;
fwrite((char*)&account, sizeof(account), 1, stream);
fclose(stream);
clrscr();
cleardevice();
titlebar();
vochers();
}
else
{
clrscr();
cleardevice();

gotoxy(25,25);
titlebar();
setcolor(RED);

settextstyle(1,0,2);
outtextxy(400,150,"Account Number W rong , Freeze or Close Account Number");
adddepo();
}
}
void vochers()
{
int i;
clrscr();
cleardevice();
titlebar();

gotoxy(27,10);
printf("Menu Bar - Account");
gotoxy(25,13);
printf(" 1. Open Account");
gotoxy(25,15);
printf(" 2 . Edit Account");
gotoxy(25,17);
printf(" 3 . Close Account");
gotoxy(25,19);
printf(" 4 . Go Back");
setcolor(YELLOW);
rectangle(175,130,375,380);
line(175,160,375,160);
line(175,165,375,165);
line(175,340,375,340);
gotoxy(23,23);
printf(" Enter your choice :");
scanf("%d",&i);
switch(i)

{ case 1:
addform();
break;
case 2:
modacc();
break;
case 3:
closewin();
break;

case 4:
clrscr();
cleardevice();
titlebar();
form1();
break;
default:

gotoxy(25,25);
printf("Wrong Decision");
delay(100);
clrscr();
cleardevice();
titlebar();
vochers();
break;
};
}
void modacc()

{
float no;
int i=1,fact=0,ca,tsize;
char name[30],address[100],city[25];
FILE *stream;
clrscr();
cleardevice();
titlebar();
stream=fopen("Sbiacc.sbi","r+b");
gotoxy(25,15);
printf("Enter Account Number: ");
scanf("%f",&no);
tsize=filelength(fileno(stream))/sizeof(account);
for(i= 1 ; i < = t s i z e ; i + + )
{
f read(&account,sizeof (account), 1,stream);
if(account.accno==no)
{
ca=i;
fact=1;
break;
}
}
If(fact==1)
{

clrscr();
cleardevice();
titlebar();
setcolor(YELLOW);
rectangle(50,150,600,450);

gotoxy(9,12);
printf("Edit Menu ");

gotoxy(9,14);
printf("============================");
fseek(stream,(long)((ca-l)*sizeof(account)),0);

gotoxy(9,16);
printf("\7Account number

: %f",account.accno);

gotoxy(9,18);
printf("Account name

gotoxy(9,20);
printf("Adress
: ");
scanf("%s",&address);

gotoxy(9,22);
printf("City
: ");
scanf("%s",city);

: %s",account.name);

strcpy(account.address,address);
strcpy(account.city,city);
fwrite((char*)&account,1,sizeof(account),stream);
fclose(stream);
vochers();
}
else
{
clrscr();
cleardevice();

gotoxy(25,25);
titlebar();
setcolor(RED);

settextstyle(1,0,1);
outtextxy(400,250,"Account Number Wrong");
printf("\7");
delay(300);
vochers();
}
}
void freezeacc()
{
int i,n,ca,fact=0;
float fre;
char c[5];
FILE *stream;
clrscr();
cleardevice();
titlebar();

gotoxy(25,20);
stream=fopen("Sbiacc.sbi","r+b");
printf("Enter the Account Number :");
scanf("%f",&fre);
n=bank.n;
for(i=1;i<n;i++)
{
fread(&account,sizeof(account),1,stream);
if (account.accno==f re)
{
fact=1;
ca=i;
break;
}
}
if(fact==1)
{
clrscr();
titlebar();

gotoxy(9,14);
printf(account Number

:%f",account.accno);

gotoxy(9,16);
printf ("Account Name

:%s",account.name);

gotoxy(9,18);
printff'You Want to Freeze this Account (y/n) :");
scanf("%s",&c);
if(strcmp(c,"y")==0)
{
fseek(stream,(long)((ca-l)*sizeof(account)),0);
strcpy(account.stat,"Freeze");
fwrite((char*)&account, sizeof(account), 1, stream);
fclose(stream);
tran();

}
else
{
fseek(stream,(long)((ca-l)*sizeof(account)),0);
strcpy(account.stat,"Open");
fwrite((char*)&account, sizeof(account), 1, stream);
fclose(stream);
tran();
}
else
{
clrscr();
cleardevice();
titlebar();
outtextxy(400,250,"Wrong Account Number");
delay(500);
tran();
}
tran();
}
void closewin()
{
int i,n,ca,fact=0;
float fre;
char c[5];
FILE *stream;
clrscr();
cleardevice();
titlebar();

gotoxy(25,20);
stream=fopen(Sbiacc.sbi,r+b);
printf(Enter the Account Number :);
scanf(%f,&fre);
n=bank.n;
for(i=1;i<n;i++)
{
fread(&account,sizeof(account),1,stream);
if(account.accno==fre)
{
fact=1;
ca=i;
break;
}
}
if(fact==1)
{
clrscr();
titlebar();

gotoxy(9,14);
printf("Account Number

:%f",account.accno);

gotoxy(9,16);
printf ("Account Name

:%s",account.name);

gotoxy(9,18);
printf ("You Want to Close this Account (y/n) :");
scanf("%s",&c);
if(strcmp(c,"y")==0)
{
fseek(stream,(long)((ca-l)*sizeof(account)),0);
strcpy(account.stat,"Close");
fwrite((char*)&account, sizeof(account), 1, stream);
fclose(stream);
tran();
}
else

{
fseek(stream,(long)((ca-l)*sizeof(account)),0);
strcpy(account.stat,"Open");
fwrite((char*)&account, sizeof(account), 1, stream);
fclose(stream);
tran();
}
}
else
{
clrscr();
cleardevice();
titlebar();
o u t t e x t x y( 4 0 0 , 2 5 0 , " W r o n g A c c o u n t N u m b e r " ) ;
delay(500);
tran();
}
tran();
}
void tran()
{
int i,j,n,sd,sm,sy,tsize;
char name[30],stat[5],accpass[25],address[101],city[25];
double ppno;
float fix,balance,accno,no;
struct date d;
FILE *stream;
getdate(&d);
clrscr();
cleardevice();
titlebar();
gotoxy(25,10);
printf(" Menu Bar-Transaction");
gotoxy(25,13);
printf(" 1. Add Deposited Amount");
gotoxy(25,15);
printf(" 2 . Freeze Accounts");
gotoxy(25,17);
printf(" 3 . Re Audit");
gotoxy(25,19);
printf(" 4 . Go Back");
gotoxy(23,23);
setcolor(YELLOW);
rectangle(175,130,375,380);
line(175,160,375,160);
line(175,165,375,165);
line(175,340,375,340);
printf(" Enter your choice :");
scanf("d",&i);
switch(i)
{
case 1:

adddepo();
break;
case 2:
freezeacc();
break;
case 3:
clrscr();
cleardevice();
titlebar();
sd = d.da_day ;
sm = d.da_mon ;
sy = d.da_year ;
stream=fopen("Sbiacc.sbi","r+b");

gotoxy(5,10);
printf("\7\n\n Interest Rate : %f Percentage ",bank.inter);
printf("\tCurrent Date : %d-%d-%d",sd,sm,sy);
printf("\n\n\n\7Sl \t Account \t Account \t Amount \t Total");
printf("\nno \t Number \t Name \t \t rate");
printf("\n -------------------------------------------------------------------------- );
n=bank.n;
for(i=0;kn-l;i++)
{
fseek(stream,(long)((i)*sizeof(account)),0);
fread(&account,sizeof(account),1,stream);
printf("\n %d \t %f %s \t %f \t %f
\t%f",i+1,account.accno,account.name,account.balance,account.balance*(bank.inter/100),(account.bala
nce)+(account.balance*(bank.inter/100)));
account.balance=(account.balance)+(account.balance*(bank.inter/100));
fseek(stream,(long)((i)*sizeof(account)),0);
fwrite((char*)&account,1,sizeof(account),stream);
delay(300);
}
printf("\n\n\t\t\t\t\t\t End Of Re-Audit. . .");
fclose(stream);
delay(5000);
tran();
break;
case 4:
form1();
break;
default:

gotoxy(25,25);
printf("\7Wrong Decision");
delay(300);
tran();
break;
};
}

void settings( )
{
int i,sd,sm,n,sy;
char n e w 1 [ 1 0 ] , o l d [ 1 0 ] , n e w 2 [ 1 0 ] ;
struct date d;
FILE *stream;
getdate( &d) ;
clrscr();
cleardevice();
titlebar();
gotoxy(25,10);
printf("Menu Bar-Settings");
gotoxy(25,13);
printf(" 1. Change Password");
gotoxy(25,15);
printf(" 2 . Change interest");
gotoxy(25,17);
printf(" 3 . Help");
gotoxy(25,19);
printf(" 4 . Go Back");
gotoxy(23,23);
setcolor(YELLOW);
rectangle(175,130,375,380);
line(17,160,3575,160);
line(17,165,3575,165);
line(17,340,3575,340);
printf(" Enter your choice :");
scanf("%d",&i);
switch(i)
{
case 1:
clrscr();
cleardevice();
titlebar();

gotoxy(10,10);
printf("Enter Old Password :");
scanf("%s",&old);

gotoxy(10,12);
printf("Enter New Password :");
scanf("%s",&new1);

gotoxy(10,14);
printf("Conform Password :");
scanf("%s",&new2);
if((strcmp(bank.pass,old)==0)&&strcmp(new1,new2)==0)
{
strcpy(bank.pass,new2);
setcolor(RED);

settextstyle(1,0,1);
outtextxy(400,250,"Password Changed");
delay(600);
clrscr();
cleardevice();
titlebar();
settings();
}
else
{
setcolor(RED);
settextstyle(1,0,3);
outtextxy(400,250,"Password Wrong");
delay(700);
clrscr();
cleardevice();
titlebar();
settings();
}
break;
case 2:
clrscr();
cleardevice();
titlebar();

gotoxy(10,12);
printf("Old Interest Rate

: %f",bank.inter);

gotoxy(10,14);
printf("Enter new Interest Rate : ");
scanf("%f",&bank.inter);
settings();
break;
case 3:
help();
break;
case 4:
clrscr();
cleardevice();
titlebar();
form1();
break;
default:

gotoxy(25,25);
printf("Wrong Decision");
delay(100);
clrscr();
cleardevice();
titlebar();
settings();
break;

};
}
void export()
{
FILE *stream;
if ((stream = fopen("A:\Sbi.sbi", "w+")) == NULL)
{ clrscr();
cleardevice();
titlebar();
gotoxy(16,15);
printf("\7Cannot Write ATM Card files .");
delay(100);
}
else
fwrite(&card, sizeof(card), 1, stream);
fclose(stream);
}
void about()
{
int i,j;
clrscr();
cleardevice();
setbkcolor(BLACK);
setcolor(4);
circle(40,70,30);
circle(130,70,30);
circle(100,130,60);
circle(150,250,100);
circle(70,220,25);
circle(230,200,25);
circle(80,320,30);
circle(240,320,30);

circle(65,115,5);
circle(120,110,5);
circle(110,150,10);
for((int) i=1;i<=10;i++)
{
setcolor(i);
sound(100);
outtextxy(300,200,"Product By :");
outtextxy(300,220," Name

: ankita bhargava");

outtextxy(300,240," Reg No : 1234");


outtextxy(300,260," College : symbiosis");
delay(300);
nosound();
}
form1();
}

void saveexit()
{
FILE *stream;
clrscr();
cleardevice();
titlebar();
if ((stream = fopen("Sbi.sbi", "wb")) == NULL)
{ clrscr();
clear device ();
titlebar();
gotoxy(16,15);
printf("Cannot Write output file.");
delay(200);
}
else
{
fwrite(&bank, sizeof(bank), 1, stream);
fclose(stream);
}

exit(0);
}

void form1()
{
int i;
clrscr();
cleardevice();
titlebar();
gotoxy(27,10);
printf(" Menu Bar");
gotoxy(25,13);
printf(" 1. Account");
gotoxy(25,15);
printf(" 2 . Display");
gotoxy(25,17);
printf(" 3 . Settings");

gotoxy(25,19);
printf(" 4 . Transaction");

gotoxy(25,21);
printf(" 5 . Save And Exit");

gotoxy(23,23);
setcolor(YELLOW);
rectangle(175,130,375,380);

line(175,160,375,160);
line(175,165,375,165);
line(175,340,375,340);
printf(" Enter your choice :");
scanf("%d",&i);

switch(i)
{
case 1:
vochers();
break;
case 2:
display();

break;
case 3:
settings();
break;
case 4:
tran();
break;
case 5:
saveexit();
break;
default:

gotoxy(25,25);
printf(W rong Decision");
delay(100);
clrscr();
cleardevice();
titlebar();
form1();
break;
};
}

void password()
{
char pas[25];

gotoxy(25,15);
printf("Enter the Password : ");
gets(pas);
if(strcmp(pas,bank.pass)==0)

{
gotoxy(25,15);
clrscr();
cleardevice();
show2();
form1();
}

else
{
clrscr();
cleardevice();

gotoxy(25,25);
titlebar();
setcolor(RED);

settextstyle(1,0,3);
outtextxy(400,250,"Password Wrong");
password();
}
}
void main()
{
int gd=DETECT,gm;
FILE *stream;
clrscr();
initgraph(&gd,&gm,"c:\\borlandc\\bgi");
if((stream=fopen("Sbi.sbi","rb"))==NULL)

{
gotoxy(25,25);
printf("Mising Files . . .");
delay(500);

exit(0);
}
fread(&bank,sizeof(bank),1,stream);
fclose(stream);
show1();
password();
getch();
}

ATM Users Code:


#include

<stdio.h>

#include

<conio.h>

#include

<graphics.h>

#include

<stdlib.h>

#include

<dos.h>

#include

<string.h>

void check();
void password();
void check();
void main();
void accview();
void chpass();
struct sbi
{
int n;
char pass[10];
float inter,fix;
}bank;
struct atm
{
float accno,ppno;
char name[30];
int age,sd,sm,sy;
char sex[5];
char stat[10];
}card;
struct acc
{
float accno;
char name[30],accpass[25],address[101],city[25];
float fix,ppno,balance;
char stat[5];
}account;
void titlebar()
{
setcolor(BLUE);

settextstyle(0,0,6);
outtextxy(30,30,"SBI");
setcolor(6);
settextstyle(0,0,2);
outtextxy(200,30,"State Bank Of India");
setcolor(7);

settetstyle(0,0,1);
outtextxy(230,50,"lamington road, Mumbai");

outtextxy(270,65,"Pin code : 451001");


line(100,100,500,100);
}

void file()
{
FILE *stream;
int n,i,j;

gotoxy(20,30);
printf("Please Insert the ATM Card");
if((stream=fopen("Sbi.sbi","a+b"))==NULL)
{
gotoxy(20,30);
fprintf(stderr,"File Missing");
}
else
{
fread(&bank,sizeof(bank),1,stream);
if ( ( s tr ea m =f o p en (" A : \ S b i.s b i" , " a +b ")) = = NU L L )

{
gotoxy(20,30);
printf("\tPlease Insert ATM Card . . .");
}
else
{
fread(&card,sizeof(card),1,stream);
if((stream=fopen("Sbiacc.sbi","a+b"))==NULL)

{
gotoxy(20,30);
printf("File Missing");
}
else
{
n=bank.n;
for(i=1;i<n;i++)
{
f read(&account,sizeof (account), 1,stream);
if((account.accno==card.accno)&&(strcmp(account.stat,"Open")==0))
{
password();
break;
}
}
}
}

fclose(stream);
}
}
void password()
{
char pass[25];
clrscr();
cleardevice();
titlebar();

gotoxy(20,15);
printf("Account Number

:%f",account.accno);

gotoxy(20,18);
printf("Enter the Password :");
scanf("%s",&pass);
if(strcmp(account.accpass,pass)==0)
check();
else
{
setcolor(RED);
settextstyle(1,0,1);
outtextx y(400,250,"Password W rong");
printf("\7");
delay(300);
main();
}
}
void balance()
{
int i;
clrscr();
cleardevice();
titlebar();
clrscr();
cleardevice();
titlebar();
setcolor(YELLOW);
rectangle(50,150,600,450);
delay(300);

gotoxy(9,14);
printf("\7Acount Number

:%f",account.accno);

gotoxy(9,16);
printf("Account Name

:%s",account.name);

gotoxy(9,18);
printf("Balance Amount

:%f",account.balance);

gotoxy(9,20);
printf("Receivable Amount :%f",account.balance-bank.fix);
delay(500);
for(i=0;i<=10;i++)
{

setcolor(i);
sound(100);
settextstyle(0,0,2);
outtextxy(55,170,"Balance View");
delay(400);
nosound();
}
check();
}

void settings()
{ int i;
clrscr();
cleardevice();
titlebar();
gotoxy(25,10);
printf(" \7Menu Bar - Settings");
gotoxy(25,13);
printf(" 1. Change Password");
gotoxy(25,15);
printf(" 2 . Account View");
gotoxy(25,17);
printf(" 3 . Go Back");
gotoxy(23,23);
setcolor(YELLOW);
rectangle(175,130,375,380);
line(175,160,375,160);
line(175,165,375,165);
line(175,340,375,340);
printf(" Enter your choice :");
scanf("%d",&i);
switch(i)
{
case 1:
chpass();
break;
case 2:
accview();
break;
case 3:
check();
break;
default:

gotoxy(25,25);
printf(\7wrong
delay(300);
check();
break;
};

Decision");

}
void accview()
{
int i;
clrscr();
cleardevice();
titlebar();

gotoxy(5,14);
printf("Account Number

:%f",account.accno);

gotoxy(40,14);
printf("Account Open Date :%d-%d-%d",card.sd,card.sm,card.sy);

gotoxy(5,16);
printf("Account Name

:%s",account.name);

gotoxy(5,18);
printf("Passport Number

:%f",account.ppno);

gotoxy(5,20);
printf ("Address

:%s", account. address);

gotoxy(5,22);
printf("City

:%s",account.city);

gotoxy(5,24);
printf("Balance Amount

:%f",account.balance);

delay(300);
for(i=0;i<=10;i++)
{
setcolor(i);
sound(100);

settextstyle(0,0,2);
outtextxy(50,170, "Account View");
delay(400);
nosound();
}
check();
}

void about()
{
int i,j;
clrscr();
cleardevice();
setbkcolor(BLACK);
setcolor(4);
circle(40,70,30);

circle(130,70,30);
circle(100,130,60);
circle(150,250,100);
circle(70,220,25);
circle(230,200,25);
circle(80,320,30);
circle(240,320,30);

circle(65,115,5);
circle(120,110,5);
circle(110,150,10);
for((int) i=1;i<=10;i++)
{
setcolor(i);
sound(100);
outtextxy(300,200,"Product By :");
outtextxy(300,220," Name

: Ankita Bhargava");

outtextxy(300,240," Reg No : 1234");


outtextxy(300,260," symbiosis college");
delay(300);
nosound();
}
check();
}
void chpass()
{
float no,balance;
int n,i,fact,ca;
char p1[25],p2[25],pass[25];
FILE *stream;
clrscr();
cleardevice();
titlebar();
no=account.accno;
stream=fopen("Sbiacc.sbi","r+b");
n=bank.n;
for(i=1;i<n;i++)
{
fread(&account,sizeof(account),1,stream);
if ((account.accno==no)&&(strcmp(account.stat,"Open")==0))
{
fact=l;
ca=i;
break;
}
else
fact=0;
}
if(fact==1)
{
fseek(stream,(long)((ca-l)*sizeof(account)),0);

gotoxy(9,14);
printf("Enter Old Password
scanf("%s",&p1);

:");

gotoxy(9,16);
printf("Enter New Password

:");

scanf("%s",&p2);

gotoxy(9,18);
printf("Enter Conform Password :");
scanf("%s",&pass);
if((strcmp(account.accpass,p1)==0)&&(strcmp(p2,pass)==0))
{
strcpy(account.accpass,pass);
fwrite((char*)&account, sizeof(account),1, stream);
setcolor(RED);
settextstyle(1,0,2);
outtextxy(400,150,"Password Changed");
delay(1000);
}
else
{
setcolor(RED);
settextstyle( 1,0,2);
outtextxy(400,150,"Password Error");
delay(1000);
}
settings();
}
}

void widrow()
{
float no,balance;
int n,i,fact,ca;
FILE *stream;
clrscr();
cleardevice();
titlebar();
no=account.accno;
stream=fopen("Sbiacc.sbi","r+b");
n=bank.n; for(i=1;i<n;i++)
for(i=1;i<n;i++)
{
fread(&account,sizeof(account),1,stream);
if ((account. accno==no)&&(strcmp(account.stat,"Open")==0))
{
fact=l;
ca=i;
break;
}
else
{

fact=0;
}
}
if(fact==1)
{
fseek(stream,(long)((ca-l)*sizeof(account)),0);

gotoxy(9,14);
printf("Total Balance Amount

:%f",account.balance);

gotoxy(9,16);
printf("Receviale Amount

:%f",account.balance-bank.fix);

gotoxy(9,18);
printf("Widrowing Amount

:");

scanf("%f",&balance);
if ((account.balance-bank.fix)>=balance)
{
account.balance=account.balance-balance;
fwrite((char*)&account, sizeof(account), 1, stream);
}
else
{
setcolor(RED);
settextstyle(1,0,2);
outtextxy(400,150,"Amount Error");
delay(1000);
}
settings();
}
}

void check()
{
int i;
clrscr();
cleardevice();
titlebar();
gotoxy(25,10);
printf(" \7Menu Bar");
gotoxy(25,13);
printf(" 1. Balance Enquiry");
gotoxy(25,15);
printf(" 2 . Settings");
gotoxy(25,17);
printf(" 3 . Windrow Cash");
gotoxy(25,19);
printf(" 4 . About Me");
gotoxy(25,21);
printf(" 5 . Exit");
gotoxy(23,23);
setcolor(YELLOW);

rectangle(175,130,375,380);
line(175,160,375,160);
line(175,165,375,165);
line(175,340,375,340);
printf(" Enter your choice :");
scanf("%d",&i);
switch(i)
{
case 1:
balance();
break;
case 2:
settings();
break;
case 3:
widrow();
break;
case 4:
about();
break;
case 5:
clrscr();
cleardevice();
titlebar();
delay(1000);

gotoxy(15,15);
printf("\please Receive Your ATM Card");
delay(2000);
main();
break;
default:
clrscr();
cleardevice();
titlebar();

gotoxy(25,25);
printf ("\7W rong Dec ision");
dela y( 300);
check();
break;
};
}
void main()
{
int gd=DETECT,gm;
char x[ 10];
FILE *stream,*f1,*f2;
initgraph(&gd,&gm,"c:\\borlandc\\bgi");
clrscr();

cleardevice();
titlebar();
getch();
}

You might also like