-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathATM - Copy.c
135 lines (127 loc) · 2.53 KB
/
ATM - Copy.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
#include<stdio.h>
void balance_f();
void deposit();
void withdraw();
void pin_f();
int pin = 1234,pinuser,pinuser2,pinuser1,withdraw_amount,deposit_amount;
char ch;
float balance = 0;
void main()
{
int n;
do
{
printf("Welcome to SBI\n.......");
printf("\n1.Check balance\n2.Deposit money\n3.Withdraw money\n4.Pin change\n5.Exit ");
printf("\n Enter your choice:");
scanf("%d",&n);
switch(n)
{
case 1:
printf("Checking balance........");
balance_f();
break;
case 2:
printf("Depositing your money.....");
deposit();
break;
case 3:
printf("Withdrawing your money......");
withdraw();
break;
case 4:
printf("Pin change request is on process....");
pin_f();
break;
case 5:
printf("Thank you!!");
break;
}
printf("\n Do you want to continue:(Y/N)");
scanf("%s",&ch);
}
while(ch=='Y'||ch=='y');
}
void balance_f()
{
printf("\nEnter your pin:");
scanf("%d",&pinuser);
if(pin==pinuser)
{
printf("Your banlance is Rs.%f",balance);
}
else
{
printf("Invalid pin");
}
}
void deposit()
{
printf("\nEnter your pin:");
scanf("%d",&pinuser);
if(pin==pinuser)
{
printf("\n Enter the amount to be deposit:");
scanf("%d",&deposit_amount);
printf("SUCESS..!Rs.%d credirted to your account",deposit_amount);
}
else
{
printf("Iinvalid pin");
}
}
void withdraw()
{
printf("\nEnter your pin:");
scanf("%d",&pinuser);
if(pin==pinuser)
{
printf("\nEnter the amount to be withdrawn");
scanf("%d",&withdraw_amount);
if(balance<withdraw_amount)
{
printf("\nInsufficeant Balance");
}
else
{
printf("SUCCESS...!!Please collect your Rs.%d",withdraw_amount);
balance=withdraw_amount;
}
}
else
{
printf("\nInvalid Pin");
}
}
void pin_f()
{
int pinuser, pinuser1, pinuser2;
printf("\nEnter your old pin:");
scanf("%d", &pinuser);
if (pin == pinuser)
{
printf("\nEnter your new pin:");
scanf("%d", &pinuser1);
printf("Confirm your new pin:");
scanf("%d", &pinuser2);
if (pinuser1 == pinuser2)
{
printf("SUCCESS.....!!Your pin has been changed.");
pin = pinuser1;
}
else
{
printf("Doesn't Match ");
goto pinn;
}
}
else
{
printf("\nIncorrect Pin!!!\tTry again");
goto pinn;
}
pinn:free (pinuser);
free (pinuser1);
free (pinuser2);
// ...
}