1.
Задан некоторый
набор товаров. Определить для каждого из товаров, какие из них имеются в каждом магазине и каких товаров нет ни в
одном магазине.
Решение
program
lab1;
const
N=3;
type
product = (bread, butter, cheese, milk);
assortiment
= set of product;
stor =
array[1..n] of assortiment;
{
type
Tmas=record
chetchik:integer=0;
mnoj:set
of product;
End;
}
var
m1:stor;
x:product;
a,b,c,xm1:assortiment;
i,j,iw,
m:integer;
{
chet:integer;
mas:array
[1..4]of Tmas;
}
begin
for i:=1 to n do
begin
xm1:=[];
writeln('enter the number of
product',i:2,'stor');
repeat
writeln('1: x:=bread; 2: x:=butter; 3:
x:=cheese; 4: x:=milk; 5: break');
writeln('Vvedite 1 or 2 or 3 or 4 or 5');
read(iw);
case iw of
1: x:=bread;
2: x:=butter;
3: x:=cheese;
4: x:=milk;
5: break;
end;
xm1:=xm1+[x];
until iw=5;
m1[i]:=xm1;
end;
{j:=0;
for x:=bread to milk do
begin
Chet:=0;
for i:=1 to n do
begin
if x in m1[i] then inc(chet);
end;
inc(j);
mas[j].chetchik:=chet;
mas[j].mnoj:=[x];
end;
for i:=1 to j do
begin
if mas[i].chetchik=n then
writeln(‘Ïðîäóêò’, [mas[j].mnoj,’ åñòü âî
âñåõ ìàãàçèíàõ ’)
else
if mas[i].chetchik=0 then
writeln(‘Ïðîäóêò’, [mas[j].mnoj,’ îòñóñòâóåò
âî âñåõ ìàãàçèíàõ ’)
end;
}
a:=m1[1];
c:=[bread..milk];
for i:=1 to n do
begin
b:=b+m1[i];
a:=a*m1[i];
c:=c-b;
end;
for i:=1 to 2 do
begin
case
i of
1:writeln('products
are in all stors:');
2:writeln('products
arent in all stors:');
end;
for x:=bread to milk do
if x in a then
case
x of
bread:writeln('bread');
butter:writeln('butter');
cheese:writeln('cheese');
milk:writeln('milk');
end;
if i=1 then a:=c;
end;
end.




