154
Pascal 4.0 User’s Guide
7
Type
shortreal
Input and Output
The Pascal function,
RetShortReal.p
function RetShortReal (r: shortreal): shortreal;
begin
RetShortReal := r + 1.0
end;
The C++ main program,
RetShortRealMain.cc
#include <stdio.h>
#include <math.h>
extern "C" float RetShortReal (float);
int main(void)
{
float r, s;
r = 2.0;
s = RetShortReal(r);
printf (" %8.6f \n", s);
}
The commands to compile and
execute
RetShortReal.p
and
RetRealMain.cc
hostname% pc -c RetShortReal.p
hostname% CC RetShortReal.o RetShortRealMain.cc -lpc
hostname% a.out
3.000000
The Pascal function,
IO.p
procedure IO;
begin
writeln ('Hello, Pascal & St.Petersburg !');
end;
Summary of Contents for SunSoft Pascal 4.0
Page 14: ...xiv Pascal 4 0 User s Guide ...
Page 16: ...xvi Pascal 4 0 User s Guide ...
Page 30: ...6 Pascal 4 0 User s Guide 1 ...
Page 160: ...136 Pascal 4 0 User s Guide 6 ...
Page 268: ...244 Pascal 4 0 User s Guide 11 ...
Page 320: ...296 Pascal 4 0 User s Guide B ...
Page 331: ...Index 307 ...
Page 333: ......