-
Notifications
You must be signed in to change notification settings - Fork 0
/
bank_management.c
192 lines (151 loc) · 5.31 KB
/
bank_management.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
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
#include <stdio.h>
#include <windows.h>
#include <math.h>
#include <time.h>
#include <string.h>
typedef struct bank Bank;
struct bank
{
char Bank_name[20];
char name[20];
long long int account_no;
int pin;
int dd;
int mm;
int yy;
long long int aadhar_card;
char pan [16];
long long int voter_id;
long long int phone;
};
int generate_random(int n)
{
srand(time(NULL));
return rand() %n;
}
int main()
{
FILE *fptr;
fptr=fopen("Bank_form.txt","w");
// checking wheatheer file is exist or not
if(fptr==NULL)
{
printf("There is no such file exists\n");
}
printf("\n\n");
// promotion
printf("Welcome to Bank Management System generated by Pursottam Sah And Chandrashekhar Tripathi\n");
printf("********************************************************************************************\n");
int n;
printf("Hello ! first decide how many customers you need to enter in data base\n");
scanf("%d",&n); // taking input as structure array
getchar();
Bank b[n];
for(int i=0;i<n;i++)
{ fprintf(fptr,"\n********************************************************************************************\n");
printf("\nEnter the details for customer %d\n",i+1);
fprintf(fptr,"\n\nDetails for customer %d\n",i+1);
printf("\n \n \n");
printf("Name of bank :\t");
scanf("%[^\n]",b[i].Bank_name);
getchar();
fprintf(fptr,"\nBank Name : %s",b[i].Bank_name);
printf("\nEnter the name of customer :");
gets(b[i].name);
getchar();
fprintf(fptr,"\ncustomer Name : %s ",b[i].name);
printf("\nEnter the account number :");
scanf("%llu",&b[i].account_no);
fprintf(fptr,"\t Acc /no : %llu",b[i].account_no);
printf("Your date of birth in dd/mm/yyyy \n");
scanf("%d/%d/%d",&b[i].dd,&b[i].mm,&b[i].yy);
getchar();
fprintf(fptr,"\nDate of birth(DOB) :%d/%d/%d ",b[i].dd ,b[i].mm, b[i].yy);
char id[10];
printf("Select the verification method type adharcard->'adhar' pancard number--> 'pan' 'voter id'-->'vote' ");
scanf("%s",id);
if(strcmp(id,"pan")==0)
{
printf("Enter the pan card number\n");
scanf("%llu",&b[i].pan);
fprintf(fptr,"Pan card number is %llu",b[i].pan);
}
else if(strcmp(id,"adhar")==0)
{
printf("Enter the adhar card number\n");
scanf("%llu",&b[i].aadhar_card);
fprintf(fptr,"\nAdhar card number : %llu\n",b[i].aadhar_card);
}
else if(strcmp(id,"vote")==0)
{
printf("Enter the voter id card number\n");
scanf("%llu",&b[i].voter_id);
fprintf(fptr,"Adhar card number : %llu",b[i].voter_id);
}
else
{
printf("Failed to take id try again\n");
break;
}
int temp_pin;
printf("Enter your 6-digit pin\n");
scanf("%d",&temp_pin);
getchar();
b[i].pin=temp_pin;
printf("You have entered your pin %d please do no share to anyone \n",b[i].pin);
int l=temp_pin %10;
int bal= generate_random(l); // beween this range
// fetching the result for the balance
float balance[10]={9277503.32,2001012,4656353.4242,30029284,5931394.23,76535.134,5453533,343566.534,233645.452,75454111.56};
printf("And your balance is %f\n",balance[bal+1]);
fprintf(fptr, "\nBalance is %f",balance[bal+1]);
//printing the actual time and date
time_t info;
time(&info);
char *s=ctime(&info); //storing the date and time in a string
fprintf(fptr,"\nchecked on latest %s",s);
printf("Submitted sucessfully check the text file in files \n");
printf("\n********************************************************************************************\n");
}
fclose(fptr);
printf("\n<<<<<<<<<<<<<<<<<<< Its time to relax !!! >>>>>>>>>>>>>>>>>>>>>>.");
// next part after exam
int oper;
printf("\nFor opening 'music' press 1 |'2'--> youtube press|'3' -->instagram | '4'---> facebook | '5' ---> linkdin");
scanf("%d",&oper);
switch(oper)
{
case 1:
{ printf("Opening Music");
system("explorer https://g.co/kgs/VddNDc");
break;
}
case 2:
{ printf("Opening Youtube");
system("explorer http://youtube.com/");
break;
}
case 3:
{ printf("Opening instagram");
system("explorer https://www.instagram.com/");
break;
}
case 4:
{ printf("Opening Facebook");
system("explorer https://www.facebook.com/");
break;
}
case 5:
{ printf("Opening Linkdin");
system("explorer https://www.linkedin.com/");
break;
}
case 6:
{
printf("Opening whatsapp \n");
system("explorer https://web.whatsapp.com/");
break;
}
}
return 0;
}