You are on page 1of 6

#include<iostream.

h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<dos.h>
#include<graphics.h>
#include<process.h>
struct bank
{
char custno[20];
char custname[20];
int acno;
char actype[20];
double amt;
int age;
char custstatus[20];
}t,temp;
void input(bank &s)
{
int x=30,y=3,a=48;
cout<<\n\n\tCustomer
name:\t;
gotoxy(x,y);
y+=2;
gets(s.custname);
cout<<\n\tCustomer
number:\t;
gotoxy(x,y);
y+=2;
gets(s.custno);
cout<<\n\tAccount
number:\t;
gotoxy(x,y);
y+=2;
cin>>s.acno;
cout<<\n\tAccount type:\t;
gotoxy(a-2,15);
cout<<TYPES of ACCOUNTS
(select one);
gotoxy(a,17);
cout<<1.)SAVINGS;

gotoxy(a,18);
cout<<2.)DEPOSITS;
gotoxy(a,19);
cout<<3.)CURRENT;
gotoxy(a,20);
cout<<4.)LOAN;
gotoxy(x,y);
y+=2;
gets(s.actype);
cout<<\n\tAmount (in
rupees) :\t;
gotoxy(x,y);
y+=2;
cin>>s.amt;
cout<<\n\tAge:\t;
gotoxy(x,y);
y+=2;
cin>>s.age;
if(s.age>=60)
strcpy(s.custstatus,Senior
Citizen);
else
strcpy(s.custstatus,Working);
}
void print(bank s[],int i)
{
clrscr();
int x=34,y=3;
cout<<\n\n\tCustomer
name:\t;
gotoxy(x,y);
y+=2;
puts(s[i].custname);
cout<<\n\tCustomer
number:\t;
gotoxy(x,y);
y+=2;
puts(s[i].custno);
cout<<\n\tAccount
number:\t;

gotoxy(x,y);
y+=2;
cout<<s[i].acno;
cout<<\n\n\tAccount type:\t;
gotoxy(x,y);
y+=2;
puts(s[i].actype);
cout<<\n\tAmount (in
rupees) :\t;
gotoxy(x,y);
y+=2;
cout<<s[i].amt;
cout<<\n\n\tAge:\t;
gotoxy(x,y);
y+=2;
cout<<s[i].age;
getch();
}
void searchCN(bank s[],int n)
{
int i,f=0;
char name[20];
cout<<\nEnter the name to be
searched\n;
gets(name);
for(i=0;i<n;i++)
{
if(strcmp(s[i].custname,name)==
0)
{
print(s,i);
f++;
}
}
if(f==0)
{

cout<<\n\n\tNo account
found with the customer name<<name;
}
}
void searchAT(bank s[],int n)
{
int i,f=0;
char account[20];
cout<<\nEnter the account
type to be searched\n;
gets(account);
for(i=0;i<n;i++)
{
if(strcmpi(s[i].actype,account)==0
)
{
print(s,i);
f++;
}
}
if(f==0)
{
cout<<\n\n\tNo account
found with the account type <<account;
}
}

void disp50K(bank s[],int n)


{
int i,ctr=0;
for(i=0;i<n;i++)
{
if(s[i].amt>50000)
{
ctr++;

print(s,i);
getch();
}
}
if(ctr>0)
{
cout<<\n\n\tThe number of
customers having amount
\n\tgreater than 50,000 -\t;
cout<<ctr;
}
else
{
cout<<\n\n\tThere are NO
customers with amount
\n\tgreater than 50,000 ;
}
}
void countAT(bank s[],int n)
{
int i,ctr=0;
char account[20];
cout<<\nEnter the account
type to be found\n;
gets(account);
for(i=0;i<n;i++)
{
if(strcmpi(s[i].actype,account)==0
)
{
ctr++;
}
}
if(ctr>0)
{
cout<<\n\n\tThe number of
customers matching with
\n\tentered account type are:\t;
cout<<ctr;
}
else

cout<<\n\n\tThere are NO
customers matching with
\n\taccount type - <<account;
}

void disp(bank s[],int n)


{
int i;
for(i=0;i<n;i++)
{
print(s,i);
getch();
}
}
void dispSC(bank s[],int n)
{
int i,f=0;
for(i=0;i<n;i++)
{
if(strcmp(s[i].custstatus,Senior
Citizen)==0)
{
print(s,i);
f++;
}
}
if(f==0)
{
cout<<\nNo Senior
Citizens \n;
}
}
void sortasc(bank s[],int n)
{
int j,i;
bank t;
for(i=0;i<n-1;i++)
{

for(j=0;j<n-1-i;j++)
{
if(s[j].amt>s[j+1].amt)
{
t=s[j];
s[j]=s[j+1];
s[j+1]=t;
}
}
}
cout<<The new sorted array
with ascending amounts :\n;
for(i=0;i<n;i++)
print(s,i);
}
void sortdes(bank s[],int n)
{
int j,i,pos;
bank t;
for(i=0;i<n-1;i++)
{
t=s[i];
pos=i;
for(j=i+1;j<n;j++)
{
if(s[j].age>t.age)
{
t=s[j];
pos=j;
}
}
temp=s[i];
s[i]=s[pos];
s[pos]=temp;
}
cout<<The new sorted array
with descending order of age :\n;
for(i=0;i<n;i++)
print(s,i)
}

void main()
{
bank s[50];
char ch,ans;
int n;
clrscr();
int grd=0,grm=1;
int gresult;
char *drname;
initgraph(&grd,&grm,
C:\\TurboC+
+\\Disk\\TurboC3\\BGI);
setcolor(14);
rectangle(0,0,639,479);
setcolor(1);
settextstyle(0,0,2);
outtextxy(240,150,Welcome
to);
settextstyle(0,0,7);
setcolor(2);
outtextxy(120,190,A.K.A.N);
settextstyle(0,0,3);
setcolor(3);
outtextxy(275,260,BANK);
settextstyle(0,0,2);
setcolor(4);
outtextxy(15,295, !!! FOOLING
customers since 2016 !!!);
delay(3000);
closegraph();
clrscr();
cout<<\n\n\t\tEnter the
number of customers \n\n;
cin>>n;
clrscr();

cout<<\n\n\tPlease enter the


details of the customers;
delay(1000);

for(int y=0;y<n;y++)
{
clrscr();
input(s[y]);
}
do
{
clrscr();
cout<<Choose from the
following:\n\n\t1.)Search on the
basis of account
type.\n\n\t2.)Search on the basis
of customer
name.\n\n\t3.)Arrange the list by
descending order on the basis of
age.\n\n\t4.)Arrange the list on the
basis of ascending order of
amount.\n\n\t5.)Count and display
customer details having amount
greater than 50000.\n\n\t6.)Enter
an account type and get the
number of customers matching
with \n\t the same
type.\n\n\t7.)Display all the
records\n\n\t8)Display the details
of customers having the status of
senior citizen.\n\n\t;
ch=getch();
clrscr();

switch(ch)
{
case '1': searchAT( s, n);
break;
case '2': searchCN( s, n);
break;
case '3': sortdes( s, n);
break;
case '4': sortasc( s, n);
break;
case '5': disp50K( s, n);
break;
case '6': countAT( s, n);
break;
case '7': disp( s, n);
break;
case '8': dispSC(s, n);
break;
default:cout<<Invalid
choice;
}
cout<<\n\nDo you want to
continue? (Y/N)\t;
ans=getch();
}while(ans=='Y'||ans=='y');
clrscr();
gotoxy(18,11);
cout<<-----! THANK YOU FOR
USING OUR BANK !-----;
delay(1000);
}// END OF MAIN()

----------------------------------*** END OF THE PROJECT


***---------------------------------

You might also like