Версия для печати темы

Нажмите сюда для просмотра этой темы в обычном формате

Форум «Всё о Паскале» _ Задачи _ Блок-схемы!

Автор: LoLzZ 6.06.2006 2:09

Помогите пожалуйста нарисовать блок-схемы.

1.

Код

program qqq;
uses graph;
type
polypoint = record
   x: integer;
   y: integer;
   end;
const scale = 100;
const poly1: array[1..11] of polypoint =
     (
      (x: 0*scale+320; y: -0*scale+240),
      (x: -1*scale+320; y: -0*scale+240),
      (x: -1*scale+320; y: 1*scale+240),
      (x: -2*scale+320; y: -0*scale+240),
      (x: 0*scale+320; y: -2*scale+240),
      (x: 0*scale+320; y: -0*scale+240),
      (x: 2*scale+320; y: -0*scale+240),
      (x: 2*scale+320; y: 2*scale+240),
      (x: 1*scale+320; y: 1*scale+240),
      (x: 0*scale+320; y: 2*scale+240),
      (x: 0*scale+320; y: -0*scale+240)
      );

var gd,gm,c:integer;a,b:real;
begin;
gd:=detect;
initgraph(gd,gm,' ');
if graphresult <> grOk then halt(1);
line (10,240,630,240);
line(320,10,320,470);
outtextxy(310,20,'y');
outtextxy(630,245,'x');
setcolor(green);
setfillstyle(Slashfill, red);
drawpoly(sizeof(poly1) div Sizeof(polypoint), poly1);
fillpoly(sizeof(poly1) div Sizeof(polypoint), poly1);
line(60,180,120,240);
line(120,240,240,360);
line(220,230,220,360);
line(120,40,540,460);
line(300,460,580,180);
line(520,200,520,460);
line(100,260,340,20);
setcolor(white);
outtextxy(325,35,'2');
outtextxy(520,230,'2');
outtextxy(110,230,'-2');
outtextxy(325,440,'-2');
outtextxy(60,160,'y=-x-2');
outtextxy(350,20,'y=x+2');
outtextxy(590,180,'y=x-2');
outtextxy(545,460,'y=-x');
outtextxy(313,10,'/\');
outtextxy(625,237,'>');
readln;
closegraph;
{program rg;
uses graph;
var a,b:real; c:integer;
begin}
a:=-2.6;c:=1;
repeat
b:=-2.5;
repeat
if ((0>=b)and(b>=a-2)) and ((0<=a)and(a<=2)) or
   ((0>=b)and(b>=-a))  and ((1<=a)and(a<=2)) or
   ((0<=b)and(b<=a+2)) and ((-2<=a)and(a<=0)) or
   ((-a-2<=b)and(b<=0)) and ((-2<=a)and(a<=-1))   then begin
writeln ('x=' ,a:4:2, '     y=' ,b:4:2, '');
c:=c+1;
if (C mod 24)=0 then begin
Writeln('Push enter');
readln;
end;
end;
b:=b+0.5;
until b>2.5;
a:=a+0.2;
until a>2.2;
readln;
end.
end.


2.В каждом столбце матрицы Р(10,10) поменять местами элементы, расположенные на главной и побочной диагоналях.
Код

uses crt;
var i,j,b:integer;
    a:array[1..10,1..10] of integer;
begin
randomize;
clrscr;
writeln;

for i:=1 to 10 do           {sozdanie isxodnoi matrizi 10x10}
  begin
  for j:=1 to 10 do
   begin
   a[i,j]:=random(9);
   write(a[i,j]:2,' ');
   end;
  writeln;writeln;
  end;
  writeln;writeln;

for j:=1 to 5 do
  begin
  for i:=1 to 10 do
   begin
   if i=j then
    begin
    b:=a[i,j];
    a[i,j]:=a[11-j,j];
    end;
   if i=11-j then a[i,j]:=b;
   end;
  end;

  for j:=6 to 10 do
   for i:=1 to 10 do
    begin
    if i=11-j then
     begin
     b:=a[i,j];
     a[i,j]:=a[j,j];
     end;
    if i=j then a[i,j]:=b;
    end;

  for i:=1 to 10 do          {Vivod izmenennoi matrizi}
   begin
   for j:=1 to 10 do
   write(a[i,j]:2,' ');
   writeln;writeln;
   end;
  readkey;
end.


3.В текстовом файле содержится последовательность действительных чисел. В указанной последовательности найти суммы положительных и отрицательных членов. Результаты дописать в конец исходного файла. Имя файла вводится с клавиатуры.
Код

program Work_with_file;
uses crt;
var f:text;
    path:string;
    n,plus,minus:integer;
begin
clrscr;
write('Enter the path to file: '); read(path);
assign(f,path);
reset(f);
plus:=0;minus:=0;
repeat
readln(f,n);
if n>0 then plus:=plus+n else minus:=minus+n;
until Eof(f);
close(f);
append(f);
writeln(f,' ');
writeln(f,'summa polojitelnix chisel: ',plus);
writeln(f,'summa otrizatelnix chisel: ',minus);
close(f);
end.


Помогите кто соображает как рисовать блок-схемы алгоритма.

Автор: volvo 6.06.2006 2:30

Иди в раздел "Ссылки", там есть тема http://forum.pascal.net.ru/index.php?showtopic=4270