home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
pascal
/
pascsrc.arc
/
CONVERT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-15
|
954b
|
29 lines
(* Chapter 3 - Program 8 *)
program Convert_From_Type_To_Type;
var Index,Count : integer;
Error_Ind : integer;
Size,Cost : real;
Letter : char;
Name,Amount : string[12];
begin
Index := 65;
Count := 66;
Cost := 124.678;
Amount := '12.4612';
Letter := Chr(Index); (* convert integer to char *)
Size := Count; (* convert integer to real *)
Index := Round(Cost); (* real to integer, rounded *)
Count := Trunc(Cost); (* real to integer, truncated *)
Index := Ord(Letter); (* convert char to integer *)
Str(Count,Name); (* integer to string of char *)
Val(Amount,Size,Error_Ind); (* string to real note that
"Error_Ind" is used for
returning an error code *)
Writeln('Name is ',Name,' and Size is ',Size:10:4);
end.