Алгоритмический язык Pascal

- , . , , , . - (), , ( System, Crt, Graph).
() , , . , .
Procedure, ,

:
Procedure Name_P(p1, p2,...: "";  Var p3, p4,...: "";...);
Function, , ,

:
Function Name_F("  "):" -";
:
Function Procedure - ,
Name_F, Name_P - ,
p1, p2 - -,
p3, p4 - -,
. . . - .

, , .

, -. , ( ). , - Type, : Type M= array[1..100]of real; , : Procedure Name_P(p: M); . , . Randomize; .
, . , Sin(x); , Y:=sin(x); (, System, ).
, . , ClrScr; CRT .

( ). () .
, .

:
Name_P(p11, p22,..., p33, p44,...);  -   Name_P, 
Y:= Name_F("  "):  -   Name_F,
:
p11, p22, . . . - ,
p33, p44, . . . - , .
Y - , .

, . - , , - . - , . - , . , -, -.
, , . , . , , , , . , , - , . . . ( ) , . , . , , . . .
.
Program NP_1;
Var
  Dat, Fam: string;  { Fam:   }
Procedure VIZ(D_R :string);            { D_R  -   }
Var
  S_t: string;{ S_t:   }
Begin
   Writeln('| --------------------------------------------- |');
   Writeln('|   :',    Fam:14,'         |');
   Writeln('|                                               |');
   Writeln('|  .  -   ',    D_R:14,'         |');
   Writeln('|  :   2-99-76                           |');
   Writeln('| ----------------------------------------------|');
   Write('   : ');
   Readln(S_t)   
end;
Begin
  Fam:='..';
  Dat:='06.12.95';    {Dat -  }
  VIZ(Dat);           {   }
  Readln;
END.
, , F_PR. pas, , : {$I F_PR. pas}
DOS :
uses DOS;                                       {   DOS }
Procedure Date_Time;
var y, m, d, d_w:word;  h, min, sec, hund: word;{  }  
begin     
  GetDate(y,m,d,d_w); {  DOS,     }
  GetTime(h,min,sec,hund);  { ,     }
  writeln(': ' );
  writeln('_':10,   d, ' ');
  writeln('_':10,   m, ' ');
  writeln('_':10,   y, ' '  );
  writeln(' : ', d_w );    { d_w= 0 - ,   . . }
  writeln(': ' );
  writeln('_':6,   h, ' ' );
  writeln('_':6,   min, ' ' );
  writeln('_':6,   sec, ' ' ); readln
end;
Begin
  Date_Time     
end.
, . "N" , , Y= 4*Sin(x)+7*Cos(x); x1<=x<=x2, N<=100 .
type r_1000= array[1. . 1000] of real;               {    r_1000 }
var Z: r_1000;  x1, x2: real;   n: word;
Procedure Mas_Y(var Y:r_1000; x1,x2:real; n:word); {Y - --}
var i: word;   x,  dx: real;                          {   }  
begin
    If (n>1000) or (n<2) then
      begin
        writeln('  >1     1000');    
        Readln;
        Halt
      end;
    i:=0;
    x:=x1;
    dx:=(x2-x1)/(n-1);     { dx -    }  
    If dx<= 0 then
      begin
        writeln('x2    x1');
        Readln;
        Halt
      end;
  While xx1)');
  Readln(x1, x2);
  Writeln('   1 
"Y" "Z", .

Halt , . Exit , .
:
Type M_3030_r= array[1..30, 1..30] of real;  {    M_3030_r }
var  x: M_3030_r;
     i, j, n, m: byte;
{------------------------------------------------------------------------}
Procedure Wr_M(a: M_3030_r;  name_f: string;  n, m: byte);
Var
  i, j: byte;                        { a -  NxM,   n<=30,  m<=30 }
  f: text;                           { name_f -   }
begin
  assign(f, name_f);
  rewrite(f);
  For i:= 1 to n do
    begin
      writeln(f);
      For j:= 1 to m do write(f, a[i,j]:6:2)
    end;
  close(f)     
end;
{------------------------------------------------------------------------}
Begin
  N:= 10;                        {    }
  for i:= 1 to N do
    for j:= i to N do
      x[i, j]:= 0.5 + random(50); {     }
  for i:= 1 to N do
    for j:= i to N do
      x[j,i]:= x[i,j]; {  ,     }
End.
, .

.
Program TR;
Var a, b, c, ha, hb, hc: real;
{----------------------------------------------------------------------------}
Function  H_TR(a, b, c: real): real;        { a, b, c -   }
Var p, s: real;
Begin
  If (a<0) or (b<0) or (c<0) Then
    begin  
      Writeln('  >0 ?');
      readln;
      Halt
    end;
  If (a>(b+c)) or (b>(a+c)) or (c>(a+b)) Then
    begin  
      Writeln('a<(b+c),  b<(a+c),  c<(a+b) ?');   
      readln;
      Halt
    end;
  p:= (a+b+c)/2;                  {  }
  s:= Sqrt(p*(p-a)*(p-b)*(p-c));  {  }
  H_TR:= 2*s/a;                   {    }
End;
{----------------------------------------------------------------}
Begin
  Writeln('    a,b,c');   
  Readln(a,b,c);
  ha:= H_TR(a, b, c);
  hb:= H_TR(b, a, c);
  hc:= H_TR(c, b, a); 
  Writeln('  :');
  Writeln('ha=',ha:-10:4, 'hb=',hb:-10:4, 'hc=',hc:-10:4);
  Readln
End.
, .

, Y= Sin(x).
PROGRAM fun_sin;
var  y,  y1,  x1: real;
{-------------------------------------------------------------------------}
Function Sin_r( x: real): real;    
Var a,  k,  y: real;  i: longint;
begin
  if abs(x) > 2*Pi Then x:= 2*pi*Frac(x/(2*Pi));     {  }
  if abs(x) > 2*Pi Then x:= x - 2*pi*Int(x/(2*Pi));            {  }
  if abs(x) > Pi Then x:= Pi - ABS(x);         {    }
  i:= 0;  a:= x;  y:= a;
  while abs(a)>0.0000001 do
    begin
      i:=i+1;
      k:=-x*x/(2*i*(2*i+1));
      a:= a*k;
      y:= y + a
    end;
  Sin_r:= y;                      {     }
end;
{-------------------------------------------------------------------------}
Begin
  write('  : x1= ');
  Readln(x1);
  Y:= Sin_r(x1);            {  ,    }
  Y1:= Sin(x1);             {    }
  writeln(' : x1= ',  x1);
  writeln('  : Sin_r(x1)= ',  y :-11:8);
  writeln(' :     Sin(x1) =  ',  y1:-11:8);
  writeln(' Enter');
  readln;
end.
. - "x" . , "y".
—одержание
    ”чебник по ¤зыку Pascal          Ћабораторные работы по программированию          —правочник




Нет комментариев.



Оставить комментарий:
Ваше Имя:
Email:
Антибот: *  
Ваш комментарий: