correction de devoir de synthese n°2
Page 1 sur 1
correction de devoir de synthese n°2
program fusion;
uses wincrt;
type
tab=array [1..50]of integer;
var
i,c1,c2,c,n,m:integer;
t,t1,t2:tab;
begin
repeat
writeln ('n='); readln(n);
until n in [2..20] ;
repeat
writeln ('m='); readln(m);
until m in [2..20 ];
repeat
writeln('t1[1]=');readln(t1[1]);
for i := 2 to n do
begin
writeln ('t1[',i,']=');readln (t1[i]); end;
until t1[i]>t1[i-1];
repeat
writeln('t2[1]=');readln(t2[1]);
for i := 2 to m do
begin
writeln ('t2[',i,']=');readln (t2[i]);
end;
until t2[i]>t2[i-1];
c:=0;c1:=1;c2:=1;
repeat
c:=c+1;
if t1[c1]< t2[c2] then
begin
t[c]:=t1[c1];
c1:=c1+1;
end
else
if t1[c1]= t2[c2] then
begin
t[c]:=t1[c1];
c1:=c1+1;
c2:=c2+1;
end
else
begin
t[c]:=t2[c2];
c2:=c2+1;
end;
until (c1>n) or (c2>m);
if c1>n then
begin
for i := c2 to m do
begin
c:=c+1;
t[c]:=t2[i]; end;
end
else
begin
for i := c1 to n do
begin
c:=c+1;
t[c]:=t1[i];
end;
end;
for i := 1 to c do
write(t[i],'.');
end.
uses wincrt;
type
tab=array [1..50]of integer;
var
i,c1,c2,c,n,m:integer;
t,t1,t2:tab;
begin
repeat
writeln ('n='); readln(n);
until n in [2..20] ;
repeat
writeln ('m='); readln(m);
until m in [2..20 ];
repeat
writeln('t1[1]=');readln(t1[1]);
for i := 2 to n do
begin
writeln ('t1[',i,']=');readln (t1[i]); end;
until t1[i]>t1[i-1];
repeat
writeln('t2[1]=');readln(t2[1]);
for i := 2 to m do
begin
writeln ('t2[',i,']=');readln (t2[i]);
end;
until t2[i]>t2[i-1];
c:=0;c1:=1;c2:=1;
repeat
c:=c+1;
if t1[c1]< t2[c2] then
begin
t[c]:=t1[c1];
c1:=c1+1;
end
else
if t1[c1]= t2[c2] then
begin
t[c]:=t1[c1];
c1:=c1+1;
c2:=c2+1;
end
else
begin
t[c]:=t2[c2];
c2:=c2+1;
end;
until (c1>n) or (c2>m);
if c1>n then
begin
for i := c2 to m do
begin
c:=c+1;
t[c]:=t2[i]; end;
end
else
begin
for i := c1 to n do
begin
c:=c+1;
t[c]:=t1[i];
end;
end;
for i := 1 to c do
write(t[i],'.');
end.
abdellaoui- Prof
- Messages : 22
Date d'inscription : 30/11/2009
Sujets similaires
» preparation au devoir de synthese n°1
» correction dcprat2
» correction dctheo_prob1
» correction dctheo_prob2
» correction serie
» correction dcprat2
» correction dctheo_prob1
» correction dctheo_prob2
» correction serie
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum