-
Notifications
You must be signed in to change notification settings - Fork 0
/
Banking system (PROJECT -2)
207 lines (201 loc) · 4.64 KB
/
Banking system (PROJECT -2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#include<stdio.h>
#include<conio.h>
#include<process.h>
struct mybank
{
int acc_no,bal;
int age;
char name[20];
int d,c,t;
};
int a,i=101,n;
void creation(struct mybank b[]);
void withdrawl(struct mybank b[],int);
void deposit(struct mybank b[],int);
void check_bal(struct mybank b[],int);
void transfer(struct mybank b[],int);
int transaction(struct mybank b[],int);
int main()
{
struct mybank b[10];
int choice;
clrscr();
printf("\n////////////////////////WELCOME TO MYBANK//////////////////////////////////////\n");
printf("\nEnter the no. of account you want to create ");
scanf("%d",&n);
for(a=0;a<n;a++)
{
creation(b);
}
printf("\n*******************************************************************");
do
{
printf("\n1=> Check balance\n2=> withdrawal\n3=> Deposit\n4=> To Transfer Money\n5=> To Create Next Two Accounts\n6=> Account Transaction History\n7=> EXIT");
printf("\nenter choice (1-7)");
scanf("%d",&choice);
clrscr();
switch(choice)
{
case 1 :printf("\n\n*****************Account current balance***********************");
check_bal(b, n);
printf("\n*******************************************************************");
break;
case 2 :printf("\n\n*******************Withdrawal************************************");
withdrawl(b, n);
printf("\n*******************************************************************");
break;
case 3 :printf("\n\n********************Deposit***************************************");
deposit(b, n);
printf("\n***********************************************************************");
break;
case 4 :printf("\n\n***********************Transfer***************************************\n");
transfer(b, n);
printf("\n*************************************************************************");
break;
case 5 :main();
break;
case 6 :printf("\n\n**********************Transaction***************************************\n");
transaction(b, n);
printf("\n*************************************************************************");
break;
case 7 :exit(0);
break;
default :break;
}
}
while(choice!=8);
return 0;
}
void creation(struct mybank b[])
{
int age;
{
printf("\n***********************CREATE ACCOUNT #%d**********************************",a+1);
printf("\nYour account no. is : %d",i);
b[a].acc_no=i;
printf("\nEnter Your Age ");
scanf("%d",&age);
b[a].age=age;
if(age>=18)
{
printf("Enter Your Name ");
scanf("%s",&b[a].name);
printf("Your Initial Deposit is : 500");
b[a].bal=500;
}
else{
printf("THIS BANK DOES NOT PROVIDE SERVICES TO THE CUSTOMERS AGED UNDER 18");
}
}
i++;
}
void withdrawl(struct mybank b[],int n)
{
int acc,amt;
printf("\nEnter Your Account No. ");
scanf("%d",&acc);
for(a=0;a<n;a++)
{
if(acc==b[a].acc_no)
{
printf("Enter amount ");
scanf("%d",&amt);
b[a].d=amt;
if(amt<=b[a].bal)
{
b[a].bal-=amt;
printf("%d : is the remaining balance after debited",b[a].bal);
printf("\n\n\tAmount is Sucessfully Withdrawn\n");
printf("\tCheck Balance For Confirmation\n");
break;
}
else
printf("\ninsufficient balance");
}
}
}
void deposit(struct mybank b[],int n)
{
int acc,am;
printf("\nEnter account no. ");
scanf("%d",&acc);
for(a=0;a<n;a++)
{
if(acc==b[a].acc_no)
{
printf("\nEnter amount ");
scanf("%d",&am);
b[a].c=am;
b[a].bal+=am;
printf("%d : is balance after credit",b[a].bal);
printf("\n\n\tAmount is Sucessfully Deposited\n");
printf("\tCheck Balance For Confirmation\n");
}
}
}
void check_bal(struct mybank b[],int n)
{
int acc;
printf("\nEnter accont no. ");
scanf("%d",&acc);
for(a=0;a<n;a++)
{
if(acc==b[a].acc_no)
{
printf("\nYour accont no. is %d",b[a].acc_no);
printf("\nAccount Holders Age is %d",b[a].age);
printf("\nAccount Holder name is %s",b[a].name);
printf("\nACCOUNT BALANCE IS %d",b[a].bal);
}
}
}
void transfer(struct mybank b[],int n)
{
int acc,amt;
printf("Enter Your Account no. ");
scanf("%d",&acc);
for(a=0;a<n;a++)
{
if(acc==b[a].acc_no)
{
printf("Enter amount ");
scanf("%d",&amt);
b[a].t=amt;
if(amt<=b[a].bal)
{
b[a].bal-=amt;
break;
}
else
printf("\nInsufficient balance");
}
}
printf("\nTransfer Money To Account no. ");
scanf("%d",&acc);
for(a=0;a<n;a++)
{
if(acc==b[a].acc_no)
{
b[a].bal+=amt;
printf("%d : is transfered to the account",amt);
printf("\n\n\tAmount is Sucessfully Transfered\n");
printf("\tCheck Balance For Confirmation\n");
}
}
}
int transaction(struct mybank b[],int n)
{
int acc;
printf("\nEnter account no. ");
scanf("%d",&acc);
for(a=0;a<n;a++)
{
if(acc==b[a].acc_no)
{
printf("%d is debited\n",b[a].d);
printf("%d is credited\n",b[a].c);
printf("%d is tranfered\n",b[a].t);
}
}
return 0;
}