forked from PashaKlybik/prog-053506
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.1(19).c
86 lines (84 loc) · 1.97 KB
/
2.1(19).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
#include<bits.h>
const double stavka = 0.1275;
double balance = 0;
int isOpen = 0;
void Init() {
printf("Initial sum: ");
scanf("%lf", &balance);
if(balance < 0) {
printf("%s", "Incorrect Enter\n");
return;
}
isOpen = 1;
}
void Add() {
if(isOpen == 0) {
printf("%s", "You don`t have a account!\n");
return;
}
printf("How much ? : ");
double x;
if(x < 0 ) {
printf("%s", "Incorrect Enter\n");
return;
}
scanf("%lf", &x);
balance += x;
}
void View() {
if(isOpen == 0) {
printf("%s", "You don`t have a account!\n");
return;
}
printf("%s%lf", "Your balance : ", balance);
}
void ViewByDay() {
if(isOpen == 0) {
printf("%s", "You don`t have a account!\n");
return;
}
printf("Enter day: ");
int k;
scanf("%d", &k);
if(k < 0) {
printf("%s", "Incorrect Enter\n");
return;
}
double buf = balance;
while(k - 30 >= 0) {
buf += buf * (stavka / 12.);
k -= 30;
}
printf("%s%lf%c", "Prediction balance : ", buf, '\n');
}
int main() {
while(1){
printf("%s", "\nMenu:\n1)Init\n2)Add\n3)View\n4)View by day\n5)Close\n6)Contacts\n7)Exit.\nChoose: ");
int f;
scanf("%d", &f);
switch(f) {
case 1 :
Init();
break;
case 2 :
Add();
break;
case 3 :
View();
break;
case 4 :
ViewByDay();
break;
case 5 :
balance = 0;
isOpen = 0;
break;
case 6 :
printf("%s", "Bank Lab po c\n Konoplich.B.A\n");
break;
case 7 :
return 0;
default: printf("%s", "Incorrect enter!!!\n");
}
}
}