CATEGORII DOCUMENTE |
Tipul multime
Sintaxa
type id_tip_multime = set of id_tip;
id_tip este un tip ordinal cu cel mult 256 elemente.
Reuniunea
program ex;
var Par, Impar, Cifra: set of byte;
begin
Par:=[0,2,4,6,8]; Impar:=[1,3,5,7,9];
Cifra:=Par + Impar
end.
Intersectia
program ex;
var Vocala, Cuvant, Inters: set of Char;
begin
Vocala:=['a','e','i','o','u','y'];
Cuvant:=['l','i','t','o','r','a','l'];
Inters:=Vocala * Cuvant
end.
Diferenta
program ex;
var Vocala, Cuvant, Dif1, Dif2, DifSimetrica: set of Char;
begin
Vocala:=['a','e','i','o','u','y'];
Cuvant:=['g','e','r','o','v','i','t','a','l'];
Dif1:=Vocala-Cuvant; Dif2:=Cuvant-Vocala;
DifSimetrica:=Dif1+Dif2
end.
Apartenenta
program
ex;
var Vocala: set of Char; lit: Char;
begin
Vocala:=['a','e','i','o','u','y'];
repeat
Write('Dati litera: '); ReadLn(lit);
if lit in Vocala then
WriteLn('Este vocala!')
else WriteLn('Nu
este vocala!')
until lit in ['.','/']
end.
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 1550
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved