1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
USES CRT;
type
ordreC=(T2,T3,T4,T5,T6,T7,T8,T9,T10,TV,TD,TR,TA,
K2,K3,K4,K5,K6,K7,K8,K9,K10,KV,KD,KR,KA,
C2,C3,C4,C5,C6,C7,C8,C9,C10,CV,CD,CR,CA,
P2,P3,P4,P5,P6,P7,P8,P9,P10,PV,PD,PR,PA,Vide);
carte=record
id:ordrec;
end;
{max_ordrec est le nombre des elements de ordrec+1}
const max_ordrec=52;
tbl:array[0..max_ordrec] of ordrec=
(T2,T3,T4,T5,T6,T7,T8,T9,T10,TV,TD,TR,TA,
K2,K3,K4,K5,K6,K7,K8,K9,K10,KV,KD,KR,KA,
C2,C3,C4,C5,C6,C7,C8,C9,C10,CV,CD,CR,CA,
P2,P3,P4,P5,P6,P7,P8,P9,P10,PV,PD,PR,PA,Vide);
nom:array[0..max_ordrec] of string[20]=
('T2','T3','T4','T5','T6','T7','T8','T9','T10','TV','TD','TR','TA',
'K2','K3','K4','K5','K6','K7','K8','K9','K10','KV','KD','KR','KA',
'C2','C3','C4','C5','C6','C7','C8','C9','C10','CV','CD','CR','CA',
'P2','P3','P4','P5','P6','P7','P8','P9','P10','PV','PD','PR','PA','Vide');
var tcarte:array[1..max_ordrec] of CARTE;
i,j,n :integer;
test:boolean;
begin
clrscr;
randomize;
for i:=1 to max_ordrec do
tcarte[i].id:=tbl[random(max_ordrec+1)] ;
{on remplit le tableau au hazard.mais le tableau ne doit pas
contenir de doublon}
for i:=0 to max_ordrec do
for j:=0 to max_ordrec do
if i<>j then
if tcarte[i].id=tcarte[j].id then begin
repeat
tcarte[j].id:=tbl[random(max_ordrec+1)]
until tcarte[i].id<>tcarte[j].id ;
i:=0;
end;
{notre tableau est enfin plein.on peut maintemant l' afficher}
clrscr;
for i:=0 to max_ordrec do
write(nom[ord(tcarte[i].id)],' ');
writeln;
{on verifie s' il ya des doublons et on affiche leurs positions}
for i:=0 to max_ordrec do
for j:=0 to max_ordrec do
if i<>j then
if tcarte[i].id=tcarte[j].id then
write(i,' ',j,'...');
readln;
END. |
Partager