-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmybank.c
76 lines (57 loc) · 1.38 KB
/
mybank.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
#include "bwave.h"
/**
* main - my bank app with C.
* Return: 0
*/
int main()
{
char option;
double balance = 50000.00;
double lastTransferAmount = 0.0;
/* Greeting message */
printf("\nHello, Welcome to Mybank. With us, Banking has been made easy. \n");
/* Create account */
createAccount();
char password[MIN_LENGTH];
int passwordCorrect = 0;
printf("Enter your password: ");
scanf("%s", password);
passwordCorrect = validatePassword(password);
if (passwordCorrect)
{
printf("Welcome to instant banking with my bank. \nYou have a fixed amount of 50,000 \n \n");
while(1)
{
printf("Menu: \n");
printf("a) Transfer funds \n");
printf("b) Deposit funds \n");
printf("c) Check balance \n");
printf("d) Quit the program \n");
printf("Select an option: ");
scanf(" %c", &option);
switch (option)
{
case 'a':
printf("Option a: Transfer Money\n");
transferMoney(&balance, &lastTransferAmount);
break;
case 'b':
printf("Option b: Deposit Money\n");
/* Add code to deposit money */
depositMoney(&balance);
break;
case 'c':
printf("Option c: Check balance\n");
/* Add code to check balance */
checkBalance(balance);
break;
case 'd':
printf("Option d: Quit the program\n");
return 0;
default:
printf("Invalid option, try again. \n");
}
}
}
return 0;
}