-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBank Management System.c
125 lines (115 loc) · 2.75 KB
/
Bank Management System.c
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
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_SIZE_ACCOUNT 100
#define MAX_SIZE 50
typedef struct
{
char Name[MAX_SIZE];
int accountNumber;
float Balence;
}Account;
void Display()
{
printf("\nWelcome To Bank Management System.\n");
printf("1. Add account\n");
printf("2. Delete Account\n");
printf("3. Add Money\n");
printf("4. Check Balence.\n");
printf("5. Exit\n");
}
void addAccount(Account Acc[], int *size)
{
if (*size < MAX_SIZE_ACCOUNT)
{
printf("Enter The Name: ");
scanf("%s", Acc[*size].Name);
printf("Enter The Account Number: ");
scanf("%d", Acc[*size].accountNumber);
(*size)++;
}
else
{
printf("Sorry Task Limit reached. Cannot add more tasks.\n");
}
}
void Delete_Account(Account Acc[], int *size, int Key)
{
for (int i = 0; i < *size; i++)
{
if (Acc[i].accountNumber == Key)
{
Acc[i] = Acc[i + 1];
printf("The account Deleted successfully\n");
(*size)--;
break;
}
}
}
void addmoney(Account Acc[], int size)
{
printf("Eneter the Amount do want to add to your account\n");
scanf("%f", Acc[size].Balence);
}
void Balence(Account Acc[], int size)
{
int Account;
printf("Enter your Account number: ");
scanf("%d", &Account);
for (int i = 0; i < size; i++)
{
if (Acc[i].accountNumber == Account)
{
printf("Your Balence: %d");
scanf("%d", Acc[i].Balence);
}
}
}
int main()
{
Account Acc[MAX_SIZE_ACCOUNT];
int numAccounts = 0;
int choice;
do
{
Display();
printf("Enter Your Choice: ");
scanf("%d ", &choice);
switch (choice)
{
case 1:
{
addAccount(Acc, &numAccounts);
break;
}
case 2:
{
int Delete;
printf("Enter the Account number to Delete: ");
scanf("%d", &Delete);
Delete_Account(Acc, &numAccounts, Delete);
break;
}
case 3:
{
addmoney(Acc, numAccounts);
break;
}
case 4:
{
Balence(Acc, numAccounts);
break;
}
case 5:
{
printf("Thanku for using me!\n");
break;
}
default:
{
printf("Please Enter an correct Choice.\n");
}
}
} while (1);
return 0;
}