You are on page 1of 1

(* haøm ñeám soá phaàn töû cuûa taäp hôïp *)

Uses Crt;
Type Tap=set of 0..99;
Const inp='Number.dat';
Var S : Tap;
i : byte;
Procedure Nhap;
Var a: byte; f: text;
Begin
S:=[];
Assign(f,inp); Reset(f);
While not SeekEoF(f) do
begin
Readln(f,a); If (a>=0)and(a<=99) then S:=S+[a];
End;
Close(f);
End;
Function Card(S: Tap): byte;
Var i,n: byte;
Begin
n:=0;
For i:=0 to 99 do If i in S then Inc(n);
Card:=n;
End;
BEGIN
Nhap;
Clrscr;
Write('Tap S co ',Card(S),' phan tu.');
Readln;
END.

You might also like