-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurrent.erl
More file actions
30 lines (27 loc) · 1.01 KB
/
Copy pathcurrent.erl
File metadata and controls
30 lines (27 loc) · 1.01 KB
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
-module(current).
-compile(export_all).
-include("records.hrl").
init_current()->
ets:new(current,[named_table,set,{keypos, #account.cnic}]).
new()->
Str="",
First=io:get_line("Enter your first name:"),
First_ex=accounts:filter_getline(First,Str),
Last=io:get_line("Enter your last name: "),
Last_ex=accounts:filter_getline(Last,Str),
Address=io:get_line("Enter your address:"),
Address_ex=accounts:filter_getline(Address,Str),
First_with_space=string:concat(First_ex," "),
Full=string:concat(First_with_space,Last_ex),
Id=io:read("Enter your CNIC number:\n "),
Id_ex=accounts:filter_read(Id),
accounts:check_status(ets:insert(current, #account{cnic=Id_ex, name=Full, address=Address_ex, date=date() , time=time() })),
Return=hd(io:get_line("|Press 'b' to back to the MAIN MENU |\n|Press 'c' to continue creating accounts|\n|Press 'q' to quit |\n")),
case Return of
$b->accounts:start();
$B->accounts:start();
$c->accounts:create();
$C->accounts:create();
$q->accounts:quit();
$Q->accounts:quit()
end.