sintassi con turbo pascal 1.1 su mac
program insieme;
type serie=set of char; var lettera,numero:serie; carattere:char; begin lettera:=['A'..'Z']; numero:=['0'..'9']; writeln('premi Q per finire'); repeat write('premi un tasto:Q per finire'); readln(carattere); writeln('-------------------'); if carattere IN lettera then writeln('tasto letterale premuto') else if carattere IN numero then writeln('tasto premuto numerico') else writeln('tasto diverso da lettera o numero') until carattere='Q'; writeln('premi return'); readln; end.
PROGRAM INSIEMI;
VAR setx,sety:set of char; setx1,sety1:set of char; prova:boolean; begin setx:=['A','B','C']; sety:=['A','B','C','D']; writeln((setx <= sety)); writeln('------------------'); setx1:=['1','2','3']; sety1:=['1','2','3','4']; writeln((setx1 <= sety1)); writeln((setx1 >= sety1)); writeln('--------------------'); prova:=setx1 <= sety1; writeln(prova); writeln('premi return'); readln; end.
PROGRAM LETTERE;
VAR A:INTEGER; VET:ARRAY[1..5] OF CHAR; BEGIN FOR A:=1 TO 5 DO BEGIN WRITE('premi tasto letterale n.',A,' ='); READLN(vet[a]); end; writeln; for a:=1 to 5 do writeln(vet[a]); writeln; for a:=5 downto 1 do writeln(vet[a]); writeln('premi return'); readln; end.
PROGRAM STRIN1;
VAR A:char; VET:ARRAY['a'..'d'] OF STRING[8]; BEGIN FOR A:='a' TO 'd' DO BEGIN WRITE('scrivi testo <8 lettere: n.',A,' ='); READLN(vet[a]); end; writeln; for a:='a' to 'd' do writeln(vet[a]); writeln; for a:='d' downto 'a' do writeln(vet[a]); writeln('premi return'); readln; end.
PROGRAM STRINGHE;
VAR A:INTEGER; VET:ARRAY[1..5] OF STRING[8]; BEGIN FOR A:=1 TO 5 DO BEGIN WRITE('scrivi testo <8 lettere: n.',A,' ='); READLN(vet[a]); end; writeln; for a:=1 to 5 do writeln(vet[a]); writeln; for a:=5 downto 1 do writeln(vet[a]); writeln('premi return'); readln; end.
PROGRAM unione;
VAR setx,sety:set of char; setx1,sety1,setd:set of char; prova:boolean; begin setx:=['A','B','C']; sety:=['A','B','C','D']; writeln((setx <= sety)); writeln('------------------'); setx1:=['1','2','3']; sety1:=['1','2','3','4']; writeln((setx1 <= sety1)); writeln((setx1 >= sety1)); writeln('--------------------'); prova:=setx1 <= sety1; writeln(prova); setd:=sety-setx; if 'D' in setd then writeln('presente'); if 'A' in setx then writeln('A presente '); writeln('premi return'); readln; end.