HP SunSoft Pascal 4.0 Bedienungsanleitung Seite 178

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 333
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 177
154 Pascal 4.0 Users 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;
Seitenansicht 177
1 2 ... 173 174 175 176 177 178 179 180 181 182 183 ... 332 333

Kommentare zu diesen Handbüchern

Keine Kommentare