Cine ma poate ajuta cu sarcinile, sa se scrie un program in pascal???
Răspunsuri la întrebare
Sarcina 1:
Program problema;
var
str : string;
c: char;
word_start: integer;
i: integer;
begin
readln(str);
word_start := 1;
i := 1;
for c in str do
begin
if c = ' ' then
begin
Insert(str[i - 1],str,word_start);
i := i + 1;
word_start := i + 1;
end;
i := i + 1;
end;
Insert (str[i - 1],str,word_start);
writeln(str);
end.
Sarcina 2:
Program problema;
var
mat: array[1..100, 1..100] of integer;
x: integer;
y: integer;
z: integer;
nr_lin: integer;
nr_col: integer;
comun: integer;
gasit_linie: boolean;
gasit_tot: boolean;
begin
read(nr_lin, nr_col);
for x := 1 to nr_lin do
for y := 1 to nr_col do
read(mat[x][y]);
writeln('Elemente comune tuturor liniilor matricei:');
for x := 1 to nr_col do
begin
comun := mat[1][x];
gasit_tot := true;
for y := 2 to nr_lin do
begin
gasit_linie := false;
for z := 1 to nr_col do
begin
if (comun = mat[y][z]) then
gasit_linie := true;
end;
if (gasit_linie = false) then
gasit_tot := false;
end;
if (gasit_tot) then
write(comun, ' ');
end;
end.