problema cu matricea este ca...
o declar asa
program caut_cu_matrice;
uses crt;
const
n=20;
max=1600;
type
index = 1..1000000;
var
a:array[1..max,1..20] of integer;
m,i,j,k:byte;
com:boolean;
f:text; ch: byte;
begin
clrscr;
writeln;
writeln; textcolor(white);
Writeln('Nr linii? ');read(m);
{Write('Nr Coloane? ');readln(n);}
assign(f,'i:\8.txt'); reset(f);
clrscr;
writeln;
writeln;
writeln(' Lucrez ...');
for i:=1 to m do for j:=1 to n do begin
{write(i,', ',j,': ');
readln(a[i,j]);}
read(f,ch);
a[i,j]:=ch;
end;
clrscr;
writeln;
writeln;
for i:=1 to m do begin
writeln;
for j:=1 to n do write(a[i,j],' ');
end;
writeln;
writeln;
write(' In toate liniile sunt: ');
for k:=1 to n do begin
i:=2; j:=1;
while(i<=m)and(j<=n)do begin
j:=1;
while(j<=n)and(a[i,j]<>a[1,k])do inc(j);
inc(i);
end; textcolor(red);
if(i>m)and(j<=n)then
Write(a[1,k],' '); textcolor(white);
end;
{write(#$D#$A+'b) In toate coloanele sunt: ');}
for k:=1 to m do begin
j:=2; i:=1;
while(j<=n)and(i<=m)do begin
i:=1;
while(i<=m)and(a[i,j]<>a[k,1])do inc(i);
inc(j);
end;
if(j>n)and(i<=m)then{ Write(a[k,1]:5); }
end;
readkey
end.
problema e limita
nu poate citi mai mult decat constanta max=1600
daca maresc aceasta constanta nu mai merge imi da
ERROR 22: STRUCTURE TOO LARGE
asta inseamna ca am depasit ce
puterea de calcul
declaratiil tipului

scuze dar nu inteleg
de aia ma gandisem sa fac cumva sa verific fisierul linie cu linie cu unul sau mai multi vectori
problema ca e nu merge
nu stiu sa asez instructiunile
am incercat asa
PROGRAM linear_search;
USES crt;
const
n=20;
kin=80;
TYPE index=1..100;
VAR cautat,i,j:integer;
gasit:boolean;
control,arr:ARRAY[1..100] OF index;
f:text; ch:byte;
BEGIN
clrscr;
writeln('LINEAR SEARCH');
assign(f,'i:\1.txt'); reset(f);
for j:=1 to kin do
begin
control[j]:=j;
cautat:=control[j];
end;
while not eof(f) do
begin
FOR i:=1 TO n DO
BEGIN
read(f,ch);
write(ch,' ');
arr[i]:=ch;
j:=0;
END;
writeln;
begin
repeat
j:=j+1;
cautat:=control[j];
i:=1;
gasit:=false;
WHILE ((i<=n) AND (gasit=false)) DO
BEGIN
IF arr[i]=cautat THEN
gasit:=true
ELSE gasit:=false;
i:=i+1;
END;
IF gasit=true THEN
writeln('Element gasit',' ',cautat)
{ ELSE
writeln('Elementul.. ',' ', cautat,'.. nu a fost gasit');}
until control[j] = kin;
writeln;
end;
end;
readkey;
END.
dar si aici ma incurc
nu stiu unde sa pun repeatul, asta daca trebuie pus,
in cazul asta cu vectorul arr de tip index
ori imi cauta decat in prima linie roate numerele din vectorul control
ori se blocheaza
cum ar trebui sa fac ?
vreo idee?
mersi pentru sugestii oricum !!!!
scuze pentru deranj !!