-
Notifications
You must be signed in to change notification settings - Fork 0
/
SysLib.pas
41 lines (32 loc) · 679 Bytes
/
SysLib.pas
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
unit SysLib; {Canboc Software Studio}
interface
procedure Errormsg(m:integer);
function StrtoReal(s:string):real;
function RealtoStr(R:real):string;
implementation
procedure Errormsg(m:integer);
begin
writeln('!!Error ',m);
halt;
end;
function StrtoReal(s:string):real;
var E:integer; ans:real;
begin
val(s,ans,E);
if E<>0 then Errormsg(10);
StrToReal:=ans;
end;
function RealtoStr(R:real):string;
var ans:string;
begin
str(R:0:15,ans);
if pos('.',ans)<>0 then
begin
while (ans[length(ans)]='0') do
delete(ans,length(ans),1);
if ans[length(ans)]='.' then
delete(ans,length(ans),1);
end;
RealtoStr:=ans;
end;
end.