-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccountsmaster.h
221 lines (211 loc) · 3.21 KB
/
accountsmaster.h
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#ifndef ACCOUNTSMASTER_H_
#define ACCOUNTSMASTER_H_
#include <fstream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
using namespace std;
class deposit
{
private:
int accno;
long double amount;
dob d;
public:
void getdata(int a, dob date, long double amt)
{
accno = a;
d = date;
amount = amt;
}
void report(int i)
{
cout << "\n";
gotoxy(1, i);
cout << accno;
gotoxy(15, i);
cout << d.date << "-" << d.month << "-" << d.year;
gotoxy(40, i);
cout << amount;
}
};
class withdraw
{
private:
int accno;
long double amount;
dob d;
public:
void getdata(int a, dob date, long double amt)
{
accno = a;
d = date;
amount = amt;
}
void report(int i)
{
cout << "\n";
gotoxy(1, i);
cout << accno;
gotoxy(15, i);
int tym();
gotoxy(40, i);
cout << amount;
}
};
class accountsmaster
{
private:
int accno;
char name[30];
char add[50];
dob d;
char no[15];
long double balance;
public:
accountsmaster()
{
balance = 0.0;
}
void getdata()
{
getlatestacno();
accno = gacno;
while (1)
{
int a;
cout << "\nEnter name: ";
gets(name);
a = check(1);
if (a == 1)
{
break;
}
break;
}
cout << "\nEnter address: ";
gets(add);
cout << "\nEnter date of birth(dd/mm/yyyy): ";
cin >> d.date >> d.month >> d.year;
cout << "\nEnter phone/mobile number: ";
cin >> no;
}
void showdata()
{
clrscr();
cout << "\n Accounts Information\n";
cout << "\nAccount number: ";
cout << accno << endl;
cout << "\nName: ";
cout << name << endl;
cout << "\nAddress: ";
cout << add << endl;
cout << "\nDate of birth(dd/mm/yyyy): ";
cout << d.date << " " << d.month << " " << d.year << endl;
cout << "\nPhone/mobile number: ";
cout << no << endl;
cout << "\nbalance:";
cout << balance;
}
char *catc()
{
return name;
}
char *catadd()
{
return add;
}
dob catdob()
{
return d;
}
int getacno()
{
return accno;
}
long double getbal()
{
return balance;
}
void editfield(int var1)
{
if (var1 == 1)
{
cout << "\nEnter modified name: ";
cin >> name;
}
else if (var1 == 2)
{
cout << "\nEnter modified address: ";
cin >> add;
}
else if (var1 == 3)
{
cout << "\nEnter modified mobile number: ";
cin >> no;
}
else if (var1 == 4)
{
cout << "\nEnter modified date of birth: ";
cin >> d.date >> d.month >> d.year;
}
}
int updatebalance(long double amt, char c)
{
int found = 0;
if (c == 'd')
{
balance = balance + amt;
found = 1;
}
else if (c == 'w')
{
if (amt > balance)
{
cout << "\nNot enough balance";
}
else
{
balance = balance - amt;
found = 1;
}
}
cout << "\nCurrent balance: " << balance;
getch();
return (found);
}
void report(int i)
{
cout << "\n";
gotoxy(1, i);
cout << accno;
gotoxy(15, i);
cout << name;
gotoxy(30, i);
cout << add;
gotoxy(53, i);
cout << balance;
}
int check(int temp)
{
int found = 1;
if (temp == 1)
{
for (int i = 0; name[i] != '\0'; i++)
{
if (isalpha(name[i]) == 0)
{
found = 0;
cout << "\nError!";
getch();
cout << "\nEnter name: ";
cin >> name;
break;
}
}
return (found);
}
}
};
#endif