CAD ComputerAided Design CAM ComputerAided Manufacturing CAE ComputerAided

  • Slides: 54
Download presentation

CAD Computer-Aided Design САПР CAM Computer-Aided Manufacturing CAE Computer-Aided Engineering

CAD Computer-Aided Design САПР CAM Computer-Aided Manufacturing CAE Computer-Aided Engineering

y 0 x 0

y 0 x 0

Массивы var A 1: array [1. . 100] of Integer; My. Array 2 =

Массивы var A 1: array [1. . 100] of Integer; My. Array 2 = array [1. . 10, 1. . 10] of integer; Dyn. Array: array of integer; Set. Length(Dyn. Array, 10); A 1[1] : = 10; x : = A 1[1]; A 1[1][3]: =5; A 1[1, 3]: =5; var Dyn. Array: array of real; Set. Length(Dyn. Array, 10, 20);

Процедуры procedure <Имя> [(параметры)]; procedure Triple. Print(str: string); var i: integer; begin Triple. Print('Hello!!!');

Процедуры procedure <Имя> [(параметры)]; procedure Triple. Print(str: string); var i: integer; begin Triple. Print('Hello!!!'); for i : = 1 to 3 do begin writeln('"'+str+'"'); end; // конец цикла for end; // конец процедуры Triple. Print procedure Circle (square: real; var radius, length: real); begin radius : = sqrt(square / pi); length : = pi * radius * 2; end; var r, l: real; . . . Circle(100, r, l);

Функции function <Имя> [(параметры)] : <тип результата>; function cube(value: integer) : integer; begin cube

Функции function <Имя> [(параметры)] : <тип результата>; function cube(value: integer) : integer; begin cube : = value * value; end; function Circle(square: real; var radius, length: real) : boolean; begin Circle : = false; if (square <= 0) then exit; radius : = sqrt(square / pi); length : = pi * radius * 2; Circle : = true; end; x : = cube(3); x : = a + cube(b) / 2;

procedure TForm 1. Form. Create(Sender: TObject); begin Randomize; // инициализируем генератор случайных чисел end;

procedure TForm 1. Form. Create(Sender: TObject); begin Randomize; // инициализируем генератор случайных чисел end; const NUM_LINES = 2000; procedure TForm 1. Draw. Lines; var i: Integer; begin for i : = 0 to NUM_LINES - 1 do begin Canvas. Pen. Color : = RGB(Random(256), Random(256)); Canvas. Line. To (Random(Client. Width), Random(Client. Height)); end;

Image 1. Canvas. Brush. Color : = cl. Green; Image 1. Canvas. Rectangle(20, 46,

Image 1. Canvas. Brush. Color : = cl. Green; Image 1. Canvas. Rectangle(20, 46, 70); Image 1. Canvas. Brush. Color : = cl. White; Image 1. Canvas. Rectangle(45, 20, 71, 70); Image 1. Canvas. Brush. Color : = cl. Red; Image 1. Canvas. Rectangle(70, 20, 96, 70); Image 1. Canvas. Brush. Style : = bs. Clear; Image 1. Canvas. Font. Name : = 'Tahoma'; Image 1. Canvas. Font. Size : = 10; x : = 20+(75 - Image 1. Canvas. Text. Width('Италия')) div 2; Image 1. Canvas. Textout(x, 70+Font. Size, 'Италия'); With Image 1. Canvas do Begin Brush. Color : = cl. Green; Rectangle(20, 46, 70); Brush. Color : = cl. White; Rectangle(45, 20, 71, 70); Brush. Color : = cl. Red; Rectangle(70, 20, 96, 70); Brush. Style : = bs. Clear; Font. Name : = 'Tahoma'; Font. Size : = 10; x : = 20+(75 - Text. Width('Италия')) div 2; Textout(x, 70+Font. Size, 'Италия'); End;

const NUM_SHAPES = 200; procedure TForm 1. Draw. Shapes; var i, Shape. Left, Shape.

const NUM_SHAPES = 200; procedure TForm 1. Draw. Shapes; var i, Shape. Left, Shape. Top: Integer; begin for i : = 0 to NUM_SHAPES - 1 do begin Canvas. Brush. Color : = RGB(Random(256), Random(256)); Shape. Left : = Random(Client. Width); Shape. Top : = Random(Client. Height); // теперь, случайным образом, решаем что рисовать case Random(3) of 0: Canvas. Rectangle(Shape. Left, Shape. Top, Shape. Left + Random(50), Shape. Top + Random(50)); 1: Canvas. Ellipse(Shape. Left, Shape. Top, Shape. Left + Random(50), Shape. Top + Random(50)); 2: begin Canvas. Font. Size : = 10 + Random(7); // от 10 до 16 Canvas. Text. Out ( Shape. Left, Shape. Top, 'Some text'); end;