Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 46

BANK OF PAKISTAN

* HEADER FILES INCLUDE IN THIS PROGRAM *


#include <conio.h>
#include <stdio.h>
#include <dos.h>
#include <string.h>
#include <stdlib.h>
#include <iostream.h>
#include <io.h>
#include <process.h>
#include <ctype.h>

* MY OWN HEADER FILES *


#include "Box.h"
#include "Valid.h"

1 :- BOX.H * (For Designing The Interface) *


void box(int a, int b, int c, int d)
{

for(int i = a; i < c; i++)


{
gotoxy(i,b); printf("\xcd");
gotoxy(i,d); printf("\xcd");
}

for(int j = b; j < d; j++)


{
gotoxy(a,j); printf("\xba");
gotoxy(c,j); printf("\xba");
}

gotoxy(a,b); printf("\xc9");
gotoxy(c,b); printf("\xbb");
gotoxy(a,d); printf("\xc8");
gotoxy(c,d); printf("\xbc");

2 :- VALID.H * (For Validation Purpose) *


#include<stdio.h>

* FUNCTION FOR ALLOWING ONLY INTEGERS *


void check_id(char *p, int size)
{
int i=0;
char ch;

do
{

ch=getch();

if( (ch>='0' && ch<='9') && (i<size-1) )


{
*p=ch;
p++;
i++;
printf("%c",ch);
}

else
if(ch==8 && i>0)
{
printf("%c%c%c",8,32,8);
i--;
p--;
}

}while(ch!=13 || i<size-1);

*p='\0';

* FUNCTION FOR ALLOWING ONLY UPPERCASE *


void check_name(char *p, int size)
{
int j=0;
char x[40],cj;

do
{

cj=toupper(getch());

if(((cj>='a' && cj<='z')||(cj>='A' && cj<='Z')||(cj==' ')) && (j<size-1))


{
*p++=cj;
j++;
printf("%c",cj);
}

else

if(cj==8 && j>0)


{
printf("%c%c%c",8,32,8);
j--; p--;
}

}while(cj!=13);

x[j]='\0';
*p='\0';

* DEFINE THE MACROS FOR THE PROGRAM *


#define NUM 5
#define MIN 2
#define MAX 20

* DEFINE STRUCTURE FOR DATABASE VARIABLES *


struct bank
{

char id[NUM];
char name[MAX];
double dep, with, bal;
int day, month, year;
int status;

}b; //Structure's Variable

* DEFINE ALL THE FUNCTIONS OF THE PROGRAM *

void splash(); Welcome Screen


void password(); Login Window (Password = wasijaved)

* MENUES FUNCTIONS *

void menu(); Main Menu of The Program


void viewmenu(); Menu For Viewing Records
void searchmenu(); Menu For Searching Records
void helpmenu(); Providing Help Options

* DATABASE FUNCTIONS OF THE PROGRAM *

void add(bank *b); Adding Records to DataBase


void deposit(bank *b); Depositing Money (Modify)
void withdraw(bank *b); Withdrawing Money (Modify)
void view(bank *b); View Records (One By One)
void viewall(bank *b); View Records (All)
void print(bank *b); Print Records (All)
void delet(bank *b); Delete Records (By Account No.)
void searchid(bank *b); Search Account (By No.)
void searchname(bank*b); Search Account (By Name)
void searchcase(bank*b);// Search Account (By Unknown Name)

* HELP FUNCTIONS *

void intro(); An Introduction To Program


void usage(); How To Use Program

void about(); About The Program


void quit(); Close The Program

* MAIN FUNCTION *

void main()
{

splash();

* ADDING RECORDS TO DATABASE *

void add(bank *b)


{

FILE *f;
char ch;
b->bal = 0;

f = fopen("Bank.dat","ab");

if (f != NULL)
{
do
{
textcolor(GREEN);
clrscr();
_setcursortype(_SOLIDCURSOR);
box(12,3,69,5);
gotoxy(31,4);
textcolor(CYAN + BLINK);
cprintf("BANK OF PAKISTAN");

box(16,7,65,20);
textcolor(CYAN);

gotoxy(29,7);
cprintf(" ++ OPEN NEW ACCOUNT ++ ");

gotoxy(27,10);
cprintf("ACCOUNT NO : ");

check_id(b->id, NUM);
gotoxy(27,12);
cprintf("ENTER NAME : ");
check_name(b->name, MAX);

{
struct date d;

getdate(&d);
b->day = d.da_day;
b->month = d.da_mon;
b->year = d.da_year;
}

_setcursortype(_NOCURSOR);

gotoxy(27,14);cputs("OPENING DATE : ");


gotoxy(42,14);cout<<b->day<<"-"<<b->month<<"-"<<b->year;

gotoxy(27,16);cprintf("CURR BALANCE : %.00lf",b->bal);

textcolor(YELLOW);
gotoxy(19,19);cputs(b->id);
gotoxy(28,19);cputs(b->name);
gotoxy(48,19);cprintf("%d-%d-%d",b->day,b->month,b->year);
gotoxy(62,19);cprintf("%.00lf",b->bal);
fwrite(b, sizeof(struct bank), 1, f);

fclose(f);

textcolor(CYAN);
gotoxy(18,23);
cprintf("DO YOU WANT TO ENTER ANOTHER RECORD? [Y]/[N] : ");

ch = getche();

} while(ch =='Y' || ch == 'y');


}

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

menu();

* DEPOSIT MONEY (Modify Records) *

void deposit(bank *b)


{

int i;
char dp[NUM];
FILE *f, *fm;

textcolor(GREEN);

clrscr();

_setcursortype(_SOLIDCURSOR);

f = fopen("Bank.dat","rb");
fm = fopen("Temp.dat","wb");
if (f != NULL)
{

box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cputs("BANK OF PAKISTAN");

box(16,7,65,22);

textcolor(CYAN);

gotoxy(30,7);
cputs(" ++ DEPOSIT MONEY ++ ");

gotoxy(24,9);
cputs("ENTER ACCOUNT NO. TO DEPOSIT : ");
check_id(dp, NUM);

rewind(f);

while(fread(b, sizeof(struct bank), 1, f))


{

if (strcmp(dp, b->id) == 0)
{

i++;
gotoxy(27,12);
cprintf("ACCOUNT NO : %s",b->id);
gotoxy(27,14);
cprintf("PERSON NAME : %s",b->name);

gotoxy(27,16);
cputs("DEPOSIT MONEY : ");
cin>>b->dep;

b->bal = b->bal + b->dep;

gotoxy(27,18);
cprintf("BALANCE NOW : %.00lf",b->bal);

_setcursortype(_NOCURSOR);
textcolor(YELLOW);
gotoxy(19,21);cputs(b->id);
gotoxy(26,21);cputs(b->name);
gotoxy(46,21);cprintf("%.00lf",b->dep);
gotoxy(59,21);cprintf("%.00lf",b->bal);

fflush(stdin);
getch();
}

fwrite(b, sizeof(struct bank), 1 ,fm);

fclose(f);
fclose(fm);

remove("Bank.dat");
rename("Temp.dat","Bank.dat");
}

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

menu();

* WITHDRAW MONEY (Modify Records) *

void withdraw(bank *b)


{

int i;
char wt[NUM];
FILE *f, *fm;

textcolor(GREEN);
clrscr();

_setcursortype(_SOLIDCURSOR);

f = fopen("Bank.dat","rb");
fm = fopen("Temp.dat","wb");

if (f != NULL)
{

box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cputs("BANK OF PAKISTAN");

box(16,7,65,22);

textcolor(CYAN);

gotoxy(31,7);
cputs(" ++ WITHDRAW MONEY ++ ");

gotoxy(24,9);
cputs("ENTER ACCOUNT NO. TO WITHDRAW : ");
check_id(wt, NUM);

rewind(f);

while(fread(b, sizeof(struct bank), 1, f))


{

if (strcmp(wt, b->id)== 0)
{
gotoxy(27,12);
cprintf("ACCOUNT NO : %s",b->id);
gotoxy(27,14);
cprintf("PERSON NAME : %s",b->name);

gotoxy(27,16);
cputs("WITHDRAW MONEY : ");
cin>>b->with;

if (b->with > b->bal)


{
menu();
}

else
{
b->bal = b->bal - b->with;
gotoxy(27,18);
cprintf("BALANCE NOW : %.00lf",b->bal);

_setcursortype(_NOCURSOR);

textcolor(YELLOW);
gotoxy(19,21);cputs(b->id);
gotoxy(26,21);cputs(b->name);
gotoxy(46,21);cprintf("%.00lf",b->with);
gotoxy(59,21);cprintf("%.00lf",b->bal);
}

fflush(stdin);
getch();
}

fwrite(b, sizeof(struct bank), 1, fm);

fclose(f);
fclose(fm);

remove("Bank.dat");
rename("Temp.dat","Bank.dat");
}

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

menu();
}
* VIEW RECORDS (One By One) *

void view(bank *b)


{

FILE *f;
char ch;

f = fopen("Bank.dat","rb");

if(f != NULL)
{
clrscr();
while( fread(b, sizeof(struct bank), 1, f))

if(b->status == 0)
{
//Calling All Records Saved in the File

textcolor(GREEN);
clrscr();

box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cprintf("BANK OF PAKISTAN");

box(16,7,65,20);

textcolor(CYAN);
gotoxy(29,7);
cprintf(" ++ VIEW ALL ACCOUNT ++ ");

_setcursortype(_NOCURSOR);

gotoxy(27,10);
cprintf("ACCOUNT NO : %s",b->id);
gotoxy(27,12);
cprintf("PERSON NAME : %s",b->name);
gotoxy(27,14);
cprintf("OPENING DATE : %d-%d-%d",b->day,b->month,b->year);
gotoxy(27,16);
cprintf("CURR BALANCE : %.00lf",b->bal);
textcolor(YELLOW);
gotoxy(19,19);cputs(b->id);
gotoxy(26,19);cputs(b->name);
gotoxy(46,19);cprintf("%d-%d-%d",b->day,b->month,b->year);
gotoxy(59,19);cprintf("%.00lf",b->bal);

getch();
}

if(b->status == 1)
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** RECORD NOT FOUND ***");
getch();
}
fclose(f);
}

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

viewmenu();

* VIEW RECORDS (All Records) *

void viewall(bank *b)


{

FILE *f;
int r = 11;
double n;
f = fopen("Bank.dat", "rb");

if (f != NULL)
{
textcolor(GREEN);
clrscr();

box(12,2,69,4);

_setcursortype(_NOCURSOR);

gotoxy(31,3);
textcolor(CYAN + BLINK);
cprintf("BANK OF PAKISTAN");

box(8,7,73,24);

textcolor(CYAN);
gotoxy(25,7);
cprintf(" ++ ALL RECORDS OF DATABASE ++ ");

textcolor(RED);
gotoxy(10,9);
cprintf("ACCOUNT NO. NAME OPENING DATE BALANCE");

n = filelength (fileno(f)) / sizeof(struct bank);

while ((fread(b, sizeof(struct bank), 1, f) == 1))


{

if(b->status == 0)
{

if(r == 22)
{
textcolor(YELLOW);
gotoxy(10,23);
cprintf("PRESS ANY KEY TO CONTINUE...");
getch();

textcolor(GREEN);

clrscr();

box(12,2,69,4);
gotoxy(31,3);
textcolor(CYAN + BLINK);
cprintf("BANK OF PAKISTAN");

box(8,7,73,24);

textcolor(CYAN);
gotoxy(25,7);
cprintf(" ++ ALL RECORDS OF DATABASE ++ ");

textcolor(RED);
gotoxy(10,9);
cprintf("ACCOUNT NO. NAME OPENING DATE BALANCE");

r = 11;
}

else
{

textcolor(CYAN);
gotoxy(12,r);
cputs(b->id);

gotoxy(26,r);
cputs(b->name);

gotoxy(50,r);
cprintf("%d-%d-%d",b->day,b->month,b->year);

gotoxy(65,r);
cprintf("%.00lf",b->bal);

r++;
}
}
}

fclose(f);

textcolor(YELLOW);
gotoxy(10,23);
cputs("END OF RECORDS");

gotoxy(54,23);
cputs("TOTAL RECORDS : ");
cout<<n;

getch();
}

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

viewmenu();

* PRINT RECORDS (All Records) *

void print(bank *b)


{

FILE *f;
clrscr();

putc('\n',stdprn);
fputs("\n\t\t\tREPRT OF SALES",stdprn);
putc('\n',stdprn);

fputs("===========================",stdprn);
putc('\n',stdprn);
putc('\n',stdprn);

gotoxy(10,9);
fprintf(stdprn,"ACCOUNT NO. NAME OPENING DATE BALANCE");

putc('\n',stdprn);
putc('\n',stdprn);

f = fopen("Bank.dat","rb");

while( (fread(b, sizeof(struct bank), 1, stdprn)) == 1)


{
fprintf(stdprn,"%d",b->id);
fprintf(stdprn,"%s",b->name);
fprintf(stdprn,"%d-%d-%d",b->day,b->month,b->year);
fprintf(stdprn,"%.00lf\n",b->bal);
}

fclose(f);

* DELETE RECORDS (By Account No.) *

void delet(bank *b)


{

int i;
char del[NUM];
char ch;
FILE *f, *fd;

textcolor(GREEN);

clrscr();

_setcursortype(_SOLIDCURSOR);

f = fopen("Bank.dat","rb");
fd = fopen("Temp.dat","wb");

if (f != NULL)
{

box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cputs("BANK OF PAKISTAN");

box(16,7,65,22);

textcolor(CYAN);

gotoxy(30,7);
cputs(" ++ DELETE ACCOUNT ++ ");
gotoxy(24,9);
cputs("ENTER ACCOUNT NO. TO DELETE : ");
check_id(del, NUM);

_setcursortype(_NOCURSOR);

while(fread(b, sizeof(struct bank), 1, f))


{

if (strcmp(del, b->id)== 0)
{

i++;
gotoxy(27,12);
cprintf("ACCOUNT NO : %s",b->id);
gotoxy(27,14);
cprintf("PERSON NAME : %s",b->name);
gotoxy(27,16);
cprintf("OPENING DATE : %d-%d-%d",b->day,b->month,b->year);
gotoxy(27,18);
cprintf("CURR BALANCE : %.00lf",b->bal);

textcolor(YELLOW);
gotoxy(19,21);cputs(b->id);
gotoxy(26,21);cputs(b->name);
gotoxy(46,21);cprintf("%d-%d-%d",b->day,b->month,b->year);
gotoxy(59,21);cprintf("%.00lf",b->bal);

gotoxy(24,23);
cputs("ARE U SURE U WANT TO DELETE ? :- ");
ch = getche();
}
}

if (ch == 'Y' || ch == 'y')


{
gotoxy(28,24);textcolor(YELLOW);
cprintf("RECORD DELETED SUCCESSFULY");
getch();
}

else if (ch == 'N'|| ch == 'n')


menu();
rewind(f);
while(fread(b, sizeof(struct bank), 1, f) == 1)
{
if (strcmp(del, b->id) != 0)
fwrite(b, sizeof(struct bank), 1, fd);
}

fclose(f);
fclose(fd);

remove("Bank.dat");
rename("Temp.dat","Bank.dat");

menu();

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

menu();

* SEARCH RECORDS (By Account No.) *

void searchid(bank *b)


{

int i;
char no[NUM];
FILE *f;

textcolor(GREEN);

clrscr();

_setcursortype(_SOLIDCURSOR);
f = fopen("Bank.dat","rb");

if (f != NULL)
{
box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cputs("BANK OF PAKISTAN");

box(16,7,65,22);
textcolor(CYAN);

gotoxy(30,7);
cputs(" ++ SEARCH ACCOUNT ++ ");

gotoxy(24,9);
cputs("ENTER ACCOUNT NO. TO SEARCH : ");
check_id(no, NUM);

_setcursortype(_NOCURSOR);

rewind(f);

while(fread(b, sizeof(struct bank), 1, f))


{

if (strcmp(no, b->id) == 0)
{
i++;
gotoxy(27,12);
cprintf("ACCOUNT NO : %s",b->id);
gotoxy(27,14);
cprintf("PERSON NAME : %s",b->name);
gotoxy(27,16);
cprintf("OPENING DATE : %d-%d-%d",b->day,b->month,b->year);
gotoxy(27,18);
cprintf("CURR BALANCE : %.00lf",b->bal);

textcolor(YELLOW);
gotoxy(19,21);cputs(b->id);
gotoxy(26,21);cputs(b->name);
gotoxy(46,21);cprintf("%d-%d-%d",b->day,b->month,b->year);
gotoxy(59,21);cprintf("%.00lf",b->bal);

fflush(stdin);
getch();
}

}
}

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

fclose(f);

searchmenu();

* SEARCH RECORDS (By Account Name) *

void searchname(bank *b)


{

int i;
char nm[MAX];
FILE *f;

textcolor(GREEN);

clrscr();

_setcursortype(_SOLIDCURSOR);

f = fopen("Bank.dat","rb");

if (f != NULL)
{
box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cputs("BANK OF PAKISTAN");

box(16,7,65,22);

textcolor(CYAN);

gotoxy(30,7);
cputs(" ++ SEARCH ACCOUNT ++ ");

gotoxy(18,9);
cputs("ENTER NAME TO SEARCH : ");
check_name(nm, MAX);

_setcursortype(_NOCURSOR);

rewind(f);

while(fread(b, sizeof(struct bank), 1, f))


{

if (strcmp(nm, b->name) == 0)
{

i++;
gotoxy(27,12);
cprintf("ACCOUNT NO : %s",b->id);
gotoxy(27,14);
cprintf("PERSON NAME : %s",b->name);
gotoxy(27,16);
cprintf("OPENING DATE : %d-%d-%d",b->day,b->month,b->year);
gotoxy(27,18);
cprintf("CURR BALANCE : %.00lf",b->bal);

textcolor(YELLOW);
gotoxy(19,21);cputs(b->id);
gotoxy(26,21);cputs(b->name);
gotoxy(46,21);cprintf("%d-%d-%d",b->day,b->month,b->year);
gotoxy(59,21);cprintf("%.00lf",b->bal);

fflush(stdin);
getch();
}

}
}
else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

fclose(f);

searchmenu();

* SEARCH RECORDS (By Unknown Name) *

void searchcase(bank *b)


{

char ch[MIN];
int r = 12, m = 0;
FILE *f;

textcolor(GREEN);

clrscr();

_setcursortype(_SOLIDCURSOR);

f = fopen("Bank.dat","rb");

if (f != NULL)
{

box(12,2,69,4);

gotoxy(31,3);
textcolor(CYAN + BLINK);
cputs("BANK OF PAKISTAN");

box(8,8,73,24);

textcolor(CYAN);
gotoxy(27,8);
cprintf(" ++ ALL MATCHING RESULTS ++ ");

textcolor(RED);
gotoxy(10,10);
cprintf("ACCOUNT NO. NAME OPENING DATE BALANCE");

textcolor(CYAN);
gotoxy(22,6);
cputs("ENTER Ist LETTER OF NAME TO SEARCH : ");
check_name(ch, MIN);

rewind(f);

_setcursortype(_NOCURSOR);

while (fread(b, sizeof(struct bank), 1, f))


{

if(b->name[m] == ch[m])
{

if(r == 22)
{
textcolor(YELLOW);
gotoxy(10,23);
cprintf("PRESS ANY KEY TO CONTINUE...");
getch();

textcolor(GREEN);

clrscr();

box(12,2,69,4);

gotoxy(31,3);
textcolor(CYAN + BLINK);
cprintf("BANK OF PAKISTAN");

box(6,8,73,24);

textcolor(CYAN);
gotoxy(25,8);
cprintf(" ++ ALL MATCHING RESULTS ++ ");

textcolor(RED);
gotoxy(10,10);
cprintf("ACCOUNT NO. NAME OPENING DATE BALANCE");

r = 12;
}

else
{

textcolor(CYAN);
gotoxy(12,r);
cputs(b->id);

gotoxy(26,r);
cputs(b->name);

gotoxy(50,r);
cprintf("%d-%d-%d",b->day,b->month,b->year);

gotoxy(66,r);
cprintf("%.00lf",b->bal);

r++;
}
}
}

fclose(f);

textcolor(YELLOW);
gotoxy(10,23);
cputs("END OF RECORDS");

getch();

else
{
clrscr();
box(26,12,55,14);
_setcursortype(_NOCURSOR);
textcolor(YELLOW + BLINK);
gotoxy(28,13);
cputs("*** ERROR OPENING FILE ***");
getch();
}

searchmenu();

* WELCOME SCREEN *

void splash()
{

textcolor(GREEN);

clrscr();

_setcursortype(_NOCURSOR);

box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cprintf("BANK OF PAKISTAN");

box(12,9,69,18);

gotoxy(35,10);
textcolor(CYAN + BLINK);
cprintf("* WELCOME *");

gotoxy(24,13);
textcolor(RED);
cprintf("PROGRAMMED BY : ");

gotoxy(16,16);
cprintf("COPYRIGHTS :-");

textcolor(YELLOW);
gotoxy(44,13);
cprintf("MUHAMMAD WASIF");

gotoxy(30,17);
cprintf("HAJVERI PROGRAMMARS [PVT] LIMITED");

delay(3000);

password();
}

* LOGIN WINDOW OF PROGRAM *

void password()
{

char pass[10] = {"wasijaved"}; // Password of the Program.


char p[10];
char ps;
char ch;
int i = 0, c = 45;

textcolor(GREEN);

clrscr();

box(12,3,69,5);

gotoxy(31,4);
textcolor(CYAN + BLINK);
cprintf("BANK OF PAKISTAN");

box(16,8,65,22);

gotoxy(30,9);
textcolor(CYAN + BLINK);
cprintf("WELCOME MUHAMMAD WASIF");

box(16,11,65,13);

textcolor(CYAN);
gotoxy(38,12);
cprintf("LOGIN");

gotoxy(28,16);
textcolor(9);
cprintf("ENTER PASSWORD : ");

textcolor(RED);

_setcursortype(_SOLIDCURSOR);

while(i <= 9 || ps !='\r')


{
ps = getche();
gotoxy(c,16);
cprintf("*");

if (ps == '\r')
break;
else
{
p[i] = ps;
c++;
i++;
}
if (i > 12) break;
}
p[i] = '\0';

_setcursortype(_NOCURSOR);

if(strcmp(p,pass) == 0)
{
gotoxy(28,18);
textcolor(YELLOW + BLINK);
cprintf("YOU ARE SUCCESSFULY LOGIN... ");

delay(3000);
menu();
}

else
{
gotoxy(27,18);
cprintf("SORRY! ACCESS DENIED..... ");
gotoxy(27,20);
cprintf("LET'S TRY AGAIN [Y]/[N] : ");

ch = getche();
}

if (ch == 'Y'|| ch == 'y')


password();

else if (ch == 'N'|| ch == 'n')


exit(0);

}
* MAIN MENU OF PROGRAM *

void menu()
{

char *ch[] = {"ADD NEW ACCOUNT","DEPOSIT MONEY","WITHDRAW


MONEY", "VIEW ACCOUNTS","DELETE ACCOUNT","SEARCH ACCOUNT",
"** HELP **","** EXIT **"};

int a;
int d = 1;
char choice;

textcolor(GREEN);

clrscr();

box(26,3,55,5);
textcolor(CYAN + BLINK);
gotoxy(28,4);
cprintf("+++BANK OF PAKISTAN+++");

box(26,6,55,8);
gotoxy(33,7);
textcolor(CYAN);
cprintf("***** MENU *****");

box(26,9,55,20);

for(int i=0;i<8;i++)
{
gotoxy(35,11+i);
textcolor(9);
cprintf(" %s ",ch[i]);
}

_setcursortype(_NOCURSOR);

textcolor(GREEN);

gotoxy(25,22);
cputs("================================");
gotoxy(25,24);
cputs("================================");

while(1)
{

kee:
for(a = 1; a <= 8; ++a)
{
if(a == d)
{

if (d == 1)
{
textcolor(RED); gotoxy(37,11);cprintf("ADD NEW ACCOUNT");
textcolor(CYAN);gotoxy(30,11); cputs("¯¯>");
gotoxy(27,23);cputs("PRESS ENTER TO ADD NEW RECORD");
}

else if (d == 2)
{
textcolor(RED); gotoxy(37,12);cprintf("DEPOSIT MONEY");
gotoxy(30,12); textcolor(CYAN); cputs("¯¯>");
gotoxy(27,23);cputs("PRESS ENTER TO DEPOSIT MONEY");
}

else if (d == 3)
{
textcolor(RED); gotoxy(37,13);cprintf("WITHDRAW MONEY");
gotoxy(30,13);textcolor(CYAN); cputs("¯¯>");
gotoxy(27,23);cputs("PRESS ENTER TO WITHDRAW MONEY");
}

else if (d == 4)
{
textcolor(RED); gotoxy(37,14);cprintf("VIEW ACCOUNTS");
gotoxy(30,14);textcolor(CYAN); cputs("¯¯>");
gotoxy(27,23);cputs("PRESS ENTER TO VIEW RECORDS");
}

else if (d == 5)
{
textcolor(RED); gotoxy(37,15);cprintf("DELETE ACCOUNT");
gotoxy(30,15);textcolor(CYAN); cputs("¯¯>");
gotoxy(27,23);cputs("PRESS ENTER TO DELETE RECORD");
}

else if (d == 6)
{
textcolor(RED); gotoxy(37,16);cprintf("SEARCH ACCOUNT");
gotoxy(30,16);textcolor(CYAN); cputs("¯¯>");
gotoxy(27,23);cputs("PRESS ENTER TO SEARCH RECORD");
}

else if (d == 7)
{
textcolor(RED); gotoxy(37,17);cprintf("** HELP **");
gotoxy(30,17);textcolor(CYAN); cputs("¯¯>");
gotoxy(28,23);cputs("PRESS ENTER TO VIEW HELP");
}

else if (d == 8)
{
textcolor(RED); gotoxy(37,18);cprintf("** EXIT **");
gotoxy(30,18);textcolor(CYAN); cputs("¯¯>");
gotoxy(27,23);cputs("PRESS ENTER TO EXIT PROGRAM");
}
}

else
{

if (a == 1)
{
textcolor(9); gotoxy(37,11);cprintf("ADD NEW ACCOUNT");
textcolor(CYAN);gotoxy(30,11); cputs(" ");
gotoxy(27,23);clreol();
}

else if (a == 2)
{
textcolor(9); gotoxy(37,12);cprintf("DEPOSIT MONEY");
gotoxy(30,12);cputs(" ");
}

else if (a == 3)
{
textcolor(9); gotoxy(37,13);cprintf("WITHDRAW MONEY");
gotoxy(30,13);cputs(" ");
}

else if (a == 4)
{
textcolor(9); gotoxy(37,14);cprintf("VIEW ACCOUNTS");
gotoxy(30,14);cputs(" ");
}
else if (a == 5)
{
textcolor(9); gotoxy(37,15);cprintf("DELETE ACCOUNT");
gotoxy(30,15);cputs(" ");
}

else if (a == 6)
{
textcolor(9); gotoxy(37,16);cprintf("SEARCH ACCOUNT");
gotoxy(30,16);cputs(" ");
}

else if (a == 7)
{
textcolor(9); gotoxy(37,17);cprintf("** HELP **");
gotoxy(30,17);cputs(" ");
}

else if (a == 8)
{
textcolor(9); gotoxy(37,18);cprintf("** EXIT **");
gotoxy(30,18);cputs(" ");
}
}
}

choice = getch();

if (choice == 13)
{
if (d == 1) add(&b);

if (d == 2) deposit(&b);

if (d == 3) withdraw(&b);

if (d == 4) viewmenu();

if (d == 5) delet(&b);

if (d == 6) searchmenu();

if (d == 7) helpmenu();

if (d == 8) quit();
}

if (choice == 0)
{
choice = getch();

if (choice == 80)
{
d++;
if (d > 8) d = 1;
goto kee;
}

if (choice == 72)
{
d--;
if (d < 1) d = 8;
goto kee;
}
}
}

* VIEW MENU *

void viewmenu()
{

char *ch[] = {"ONE BY ONE","VIEW ALL","PRINT REC.","<< BACK >>"};


int a;
int d = 1;
char choice;

textcolor(GREEN);

clrscr();

box(26,3,55,5);
textcolor(CYAN + BLINK);
gotoxy(28,4);
cprintf("+++BANK OF PAKISTAN+++");

box(31,8,50,10);
gotoxy(33,9);
textcolor(CYAN);
cprintf("** VIEW MENU **");

box(26,12,55,19);

for(int i = 0;i < 4; i++)


{
gotoxy(35,14+i);
textcolor(9);
cprintf(" %s ",ch[i]);
}

_setcursortype(_NOCURSOR);

textcolor(GREEN);

gotoxy(25,22);
cputs("================================");
gotoxy(25,24);
cputs("================================");

while(1)
{

kee:
for(a = 1; a <= 4; ++a)
{

if(a == d)
{

if (d == 1)
{
gotoxy(37,14);textcolor(RED);cprintf("ONE BY ONE");
gotoxy(30,14);textcolor(CYAN); cputs("¯¯>");
gotoxy(26,23);cputs("PRESS ENTER TO VIEW ONE BY ONE");
}

else if (d == 2)
{
gotoxy(37,15);textcolor(RED);cprintf("VIEW ALL");
gotoxy(30,15);textcolor(CYAN); cputs("¯¯>");
gotoxy(26,23);cputs("PRESS ENTER TO VIEW ALL RECORD");
}

else if (d == 3)
{
gotoxy(37,16);textcolor(RED);cprintf("PRINT REC.");
gotoxy(30,16);textcolor(CYAN); cputs("¯¯>");
gotoxy(26,23);cputs("PRESS ENTER TO GO BACK TO MAIN");
}

else if (d == 4)
{
gotoxy(37,17);textcolor(RED);cprintf("<< BACK >>");
gotoxy(30,17);textcolor(CYAN); cputs("¯¯>");
gotoxy(26,23);cputs("PRESS ENTER TO GO BACK TO MAIN");
}
}

else
{

if (a == 1)
{
gotoxy(37,14);textcolor(9);cprintf("ONE BY ONE");
gotoxy(30,14);cputs(" ");
gotoxy(27,23);clreol();
}

else if (a == 2)
{
gotoxy(37,15);textcolor(9);cprintf("VIEW ALL");
gotoxy(30,15);cputs(" ");
}

else if (a == 3)
{
gotoxy(37,16);textcolor(9);cprintf("PRINT REC.");
gotoxy(30,16);cputs(" ");
}

else if (a == 4)
{
gotoxy(37,17);textcolor(9);cprintf("<< BACK >>");
gotoxy(30,17);cputs(" ");
}

choice = getch();
if (choice == 13)
{
if (d == 1) view(&b);

if (d == 2) viewall(&b);

if (d == 3) print(&b);

if (d == 4) menu();
}

if (choice == 0)
{
choice = getch();

if (choice == 80)
{
d++;
if (d > 4) d = 1;
goto kee;
}

if (choice == 72)
{
d--;
if (d < 1) d = 4;
goto kee;
}
}
}

* SEARCH MENU *

void searchmenu()
{

char *ch[] = {"SEARCH ACCOUNT","SEARCH NAME","SEARCH CASE",


"<<< BACK >>>"};
int a;
int d = 1;
char choice;

textcolor(GREEN);
clrscr();

box(26,3,55,5);
textcolor(CYAN + BLINK);
gotoxy(28,4);
cprintf("+++BANK OF PAKISTAN+++");

box(31,8,50,10);
gotoxy(33,9);
textcolor(CYAN);
cprintf("* SEARCH MENU *");

box(26,12,55,19);

for(int i = 0;i < 4; i++)


{
gotoxy(35,14+i);
textcolor(9);
cprintf(" %s ",ch[i]);
}

_setcursortype(_NOCURSOR);

textcolor(GREEN);

gotoxy(25,22);
cputs("================================");
gotoxy(25,24);
cputs("================================");

while(1)
{

kee:
for(a = 1; a <= 4; ++a)
{

if(a == d)
{

if (d == 1)
{
gotoxy(37,14);textcolor(RED);cprintf("SEARCH ACCOUNT");
gotoxy(30,14);textcolor(CYAN); cputs("¯¯>");
gotoxy(25,23);cputs("PRESS ENTER TO SEARCH BY ACCOUNT");
}

else if (d == 2)
{
gotoxy(37,15);textcolor(RED);cprintf("SEARCH NAME");
gotoxy(30,15);textcolor(CYAN); cputs("¯¯>");
gotoxy(26,23);cputs("PRESS ENTER TO SEARCH BY NAME");
}

else if (d == 3)
{
gotoxy(37,16);textcolor(RED);cprintf("SEARCH CASE");
gotoxy(30,16);textcolor(CYAN); cputs("¯¯>");
gotoxy(26,23);cputs("PRESS ENTER TO SEARCH BY CASE");
}

else if (d == 4)
{
gotoxy(37,17);textcolor(RED);cprintf("<<< BACK >>>");
gotoxy(30,17);textcolor(CYAN); cputs("¯¯>");
gotoxy(26,23);cputs("PRESS ENTER TO GO BACK TO MAIN");
}
}

else
{

if (a == 1)
{
gotoxy(37,14);textcolor(9);cprintf("SEARCH ACCOUNT");
gotoxy(30,14);cputs(" ");
gotoxy(27,23);clreol();
}

else if (a == 2)
{
gotoxy(37,15);textcolor(9);cprintf("SEARCH NAME");
gotoxy(30,15);cputs(" ");
}

else if (a == 3)
{
gotoxy(37,16);textcolor(9);cprintf("SEARCH CASE");
gotoxy(30,16);cputs(" ");
}
else if (a == 4)
{
gotoxy(37,17);textcolor(9);cprintf("<<< BACK >>>");
gotoxy(30,17);cputs(" ");
}

choice = getch();

if (choice == 13)
{
if (d == 1) searchid(&b);

if (d == 2) searchname(&b);

if (d == 3) searchcase(&b);

if (d == 4) menu();
}

if (choice == 0)
{
choice = getch();

if (choice == 80)
{
d++;
if (d > 4) d = 1;
goto kee;
}

if (choice == 72)
{
d--;
if (d < 1) d = 4;
goto kee;
}
}
}

}
* HELP MENU *

void helpmenu()
{

char *ch[] = {"*INTRODUCTION*","*HOW TO USE ?*","**ABOUT BANK**",


"<<< BACK >>>"};
int a;
int d = 1;
char choice;

textcolor(GREEN);

clrscr();

box(26,3,55,5);
textcolor(CYAN + BLINK);
gotoxy(28,4);
cprintf("+++BANK OF PAKISTAN+++");

box(8,6,28,8);
gotoxy(12,7);
textcolor(CYAN);
cprintf("* HELP MENU *");

box(6,10,30,17);

for(int i = 0;i < 4; i++)


{
gotoxy(11,12+i);
textcolor(9);
cprintf(" %s ",ch[i]);
}

_setcursortype(_NOCURSOR);

textcolor(GREEN);

gotoxy(5,22);
cputs("===========================");
gotoxy(5,24);
cputs("===========================");

while(1)
{
kee:
for(a = 1; a <= 4; ++a)
{

if(a == d)
{
textcolor(CYAN);

if (d == 1)
{
gotoxy(13,12);textcolor(RED);cprintf("*INTRODUCTION*");
gotoxy(8,12); textcolor(CYAN); cputs("¯>");
gotoxy(5,23); cputs("PRESS ENTER FOR INTRODUCTION");
}

else if (d == 2)
{
gotoxy(13,13);textcolor(RED);cprintf("*HOW TO USE ?*");
gotoxy(8,13); textcolor(CYAN); cputs("¯>");
gotoxy(5,23); cputs("PRESS ENTER TO LEARN USAGE");
}

else if (d == 3)
{
gotoxy(13,14);textcolor(RED);cprintf("**ABOUT BANK**");
gotoxy(8,14); textcolor(CYAN); cputs("¯>");
gotoxy(7,23); cputs("PRESS ENTER FOR CONTACT");
}

else if (d == 4)
{
gotoxy(13,15);textcolor(RED);cprintf("<<< BACK >>>");
gotoxy(8,15); textcolor(CYAN); cputs("¯>");
gotoxy(7,23); cputs("PRESS ENTER TO GO BACK");
}
}

else
{

if (a == 1)
{
gotoxy(13,12);textcolor(9);cprintf("*INTRODUCTION*");
gotoxy(8,12); cputs(" ");
gotoxy(5,23); clreol();
}
else if (a == 2)
{
gotoxy(13,13);textcolor(9);cprintf("*HOW TO USE ?*");
gotoxy(8,13); cputs(" ");
}

else if (a == 3)
{
gotoxy(13,14);textcolor(9);cprintf("**ABOUT BANK**");
gotoxy(8,14); cputs(" ");
}

else if (a == 4)
{
gotoxy(13,15);textcolor(9);cprintf("<<< BACK >>>");
gotoxy(8,15); cputs(" ");
}

choice = getch();

if (choice == 13)
{
if (d == 1) intro();

if (d == 2) usage();

if (d == 3) about();

if (d == 4) menu();
}

if (choice == 0)
{
choice = getch();

if (choice == 80)
{
d++;
if (d > 4) d = 1;
goto kee;
}
if (choice == 72)
{
d--;
if (d < 1) d = 4;
goto kee;
}
}
}

* INTRODUCTION TO BANK OF PAKISTAN *

void intro()
{

textcolor(GREEN);

box(35,6,75,22);

_setcursortype(_NOCURSOR);

textcolor(RED);

gotoxy(38,8);
cputs("BANK OF PAKISTAN is a SOFTWARE that");
gotoxy(38,9);
cputs("can used for Simple Bank Management");
gotoxy(38,10);
cputs("Purpose. It has a Beautiful GUI for");
gotoxy(38,11);
cputs("Easy Understanding for the Users.");

gotoxy(38,13);
cputs("Just Press Enter on The Option You");
gotoxy(38,14);
cputs("Want to View");

gotoxy(39,17);
cputs("PLZ! Give Me Your Comments About");
gotoxy(39,18);
cputs("The Software [BANK OF PAKISTAN].");

textcolor(YELLOW);
gotoxy(39,21);
cputs("For Contact PLZ Read ABOUT Option");

getch();

helpmenu();

* HOW TO USE *

void usage()
{

textcolor(GREEN);

box(35,6,75,22);

_setcursortype(_NOCURSOR);

textcolor(RED);

gotoxy(38,8);
cputs("Simply By using Arrows Keys Move in");
gotoxy(38,9);
cputs("The Program as You Want. I Also Try");
gotoxy(38,10);
cputs("To Guide You Through The Instruction");
gotoxy(38,11);
cputs("Which Appaears Bottom of The Screen.");

gotoxy(38,12);
cputs("Just Follow The Instruction to Work.");

gotoxy(39,14);
cputs("If You Put a Wrong Entry in Search,");
gotoxy(39,15);
cputs("Deletint,Deposit & Withdraw Section");
gotoxy(39,16);
cputs("You'll Back to Prev Window.");

gotoxy(37,18);
cputs("Printing Option may not Work Properly");

gotoxy(39,20);
cputs("If Still Then You Face Any Problem");
textcolor(YELLOW);

gotoxy(39,21);
cputs("Plz! Mail: wasi_javed@hotmail.com");

getch();

helpmenu();

* ABOUT THE AUTHOR OF PROGRAM *

void about()
{

textcolor(GREEN);

box(35,6,75,22);

_setcursortype(_NOCURSOR);

textcolor(CYAN);

gotoxy(48,8);
cputs("*** MADE BY ***");

gotoxy(48,12);
cputs("*** CONTACT ***");

gotoxy(47,16);
cputs("*** COPYRIGHT ***");

textcolor(RED);

gotoxy(46,10);
cputs("MUHAMMAD WASIF JAVED");

gotoxy(43,14);
cputs("www.wasi_javed@hotmail.com");

gotoxy(40,18);
cputs("HAJVERI PROGRAMARS [PVT] LIMITED");

textcolor(YELLOW);
gotoxy(37,21);
cputs("PLZ! MAIL AS SUBJECT BANK OF PAKISTAN");

getch();

helpmenu();

* CLOSE THE PROGRAM *

void quit()
{

char ch;

textcolor(GREEN);

clrscr();

_setcursortype(_NOCURSOR);

box(26,5,55,7);

textcolor(CYAN + BLINK);

gotoxy(29,6);
cputs("++++BANK OF PAKISTAN++++");

box(15,12,66,16);

textcolor(CYAN);

gotoxy(18,14);
cputs("ARE YOU SURE YOU WANT TO EXIT ? [Y] / [N] : ");

ch = getche();

if (ch == 'Y' || ch == 'y')


{
gotoxy(24,18);
textcolor(14);
cputs("THANK YOU FOR USING THIS SOFTWARE");
delay(2000);
exit(0);
}

else if (ch == 'N'|| ch == 'n')


menu();

else
quit();

END OF PROGRAM

REMARKS :-

Thanks to Almighty Allah Whom give me the so much Knowledge to Create this
Program Name “BANK OF PAKISTAN”.

Special Acknowledgement : Muhammad Asif & Muhammad Waqas

They Help me a lot to make this Project.

Special Thanks to www.Planet-Source-Code.com

Which Provide me not only the Ideas but New Techniques for Programming in C
& C++.

A very very Special Thanks to My Teacher Sir Mian Adnan Ameen who
taught me so well.

Because of him I feel comfortable to make database program easily in C & C++.

You might also like