-
Notifications
You must be signed in to change notification settings - Fork 1
/
CALC1.PRG
131 lines (91 loc) · 3.08 KB
/
CALC1.PRG
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
set talk off
set date british
clear
s=0
z=0
# storing no to variables to work in input ( numeric data type )
exit = 0
store 1 to about
clear = 2
ascii = 3
# sum of digits = sd
sd= 4
help = 5
pie=22/7
ttime=0
# database user check
USE DATABASE
clear
ACCEPT "Enter your name : " to named
LOCATE for DATABASE.NAME= named
if named == ALLTRIM(DATABASE.NAME)
accept "Enter your password :" to passwordd
if passwordd == ALLTRIM(DATABASE.PASSWORD)
clear
# initial time calculation
timei = time()
timehi = substr(timei,1,2)
timemi = substr(timei,4,2)
timesi = substr(timei,7,2)
ttimei = val(timehi)*3600+val(timemi)*60+val(timesi)
# main screen header
?" You are logged in as : ",DATABASE.NAME," at",timei," on ", date()
?" "
?" Welcome to calc1, a prototype calculator developed in FoxPro 2.5, inspired by"
?" the Free Software Foundation's command line 'bc calculator'."
?"--------------------------------------------------------------------------------"
do oprat
# the entire program exits after executing oprat
else
?"You have entered incorrect password."
?" Contact your system admin."
endif
else
? "You are not registered!"
?"================================================================================"
? " "
? " "
ACCEPT "Register yourself with us [y/n] : " to regis
if regis = "y"
append blank
accept "Please enter your name : " to nm
? "Set a password : "
accept to pas
p = len(pas)
if p >= 8
for j = 1 to p
pd ="*"
?? pd
endfor
repl name with nm,password with pas
t = 0
do while t < 3
? " confirm your password : "
accept to pass
p = len(pass)
for j = 1 to p
pd = "*"
?? pd
endfor
if pass = alltrim(DATABASE.password)
wait window " You are registered " nowait
delete for name=space(20)
pack
close all
exit
else
t = t + 1
? " You entered an incorrect password "
? " ////////// try again \\\\\\\\\\\\\ "
endif
delete for name = space(20)
pack
enddo
else
?" Your password must atleast 8 characters long "
? "Please try again."
endif
close all
endif
endif
set talk on