|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1792 (0x700)
Types: TextFile
Names: »CHECK1.PAS«
└─⟦08ea08c61⟧ Bits:30003924 PolyPascal programmer
└─⟦this⟧ »CHECK1.PAS«
PROGRAM check1;
CONST
maxtegn = 10;
TYPE
cifre = 0 .. 9;
vektor = ARRAY(.1 .. maxtegn.) OF cifre;
cifferstreng = STRING(.maxtegn.);
VAR
i, position : INTEGER;
v : vektor;
cstreng : cifferstreng;
retur : CHAR;
BEGIN
REPEAT
WRITE(CLRHOM);
GOTOXY(10, 5);
WRITE('Indtast et helt tal på ', maxtegn, ' cifre.');
GOTOXY(10, 7);
WRITE('Tast tallet her: <');
FOR i := 1 TO maxtegn DO
WRITE(' ');
WRITE('>');
BUFLEN := maxtegn;
GOTOXY(28, 7);
READLN(cstreng);
position := 0;
FOR i := LEN(cstreng) TO maxtegn DO
cstreng := cstreng + ' ';
FOR i := maxtegn DOWNTO 1 DO
IF (cstreng(.i.) < '0') OR (cstreng(.i.) > '9')
THEN position := i;
IF position > 0 (* Fejlagtigt tegn fundet *)
THEN
BEGIN
GOTOXY(27 + position, 8);
WRITE('▶92◀');
GOTOXY(27 + position, 9);
WRITE('Fejlagtigt tegn - Tast <RETURN>');
READLN(retur);
END;
UNTIL position = 0;
GOTOXY(10, 9);
WRITE('Cifrene er: ');
FOR i := 1 TO maxtegn DO
BEGIN
v(.i.) := ORD(cstreng(.i.)) - ORD('0');
WRITE(v(.i.) : 2);
END;
WRITELN;
END.
«eof»