курсовая по информатике. Отчет по курсовой работе по теме Разработка программного модуля на языке программирования высокого уровня для решения инженерных задач
Скачать 1.16 Mb.
|
1.3 Описание алгоритмаА. Начать исполнение. Создать форму. Нанести на созданную форму элементы: TButton, TImage, TLabel, TEdit. Назвать 3 кнопки «Расчет» и 1 кнопку «Чертеж». Если нажать на первую кнопку «Расчет», то выведется сообщение «Рz = …». Если нажать на вторую кнопку «Расчет», то выведется сообщение «L = …». Если нажать на третью кнопку «Расчет», то выведутся результаты вычислений «l, S, , ». Если нажать на кнопку «Чертеж», то на экране появится изображение подшипника с размерами, с помощью процедур: Polygon, RoundRect, Rectangle, Ellipse, MoveTo, LineTo, TextOut. Конец цикла. Б. Закончить исполнение 1.4 Текст программыunit z1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Edit1: TEdit; Edit10: TEdit; Edit11: TEdit; Edit12: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; Edit7: TEdit; Edit8: TEdit; Edit9: TEdit; Image1: TImage; Label1: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; Label18: TLabel; Label19: TLabel; Label2: TLabel; Label20: TLabel; Label21: TLabel; Label22: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Edit11Change(Sender: TObject); private public end; var Form1: TForm1; x, y, Fa, Fr, K6, Kt, V, Pz, c, n, D2, d, dt, s, l, d1,L2 :real; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin x:=StrtoFloat(Edit1.text); y:=StrtoFloat(Edit2.text); Fa:=StrtoFloat(Edit3.text); Fr:=StrtoFloat(Edit4.text); K6:=StrtoFloat(Edit5.text); Kt:=StrtoFloat(Edit6.text); V:=StrtoFloat(Edit7.text); Pz:=(x*v*Fr+y*Fa)*K6*Kt ; showmessage ('Pz='+FloatToStr((x*v*Fr+y*Fa)*K6*Kt)+'кН'); end; procedure TForm1.Button2Click(Sender: TObject); begin Pz:=StrtoFloat(Edit8.text); c:=StrtoFloat(Edit9.text); n:=StrtoFloat(Edit10.text); L2:=(exp(n*ln(c/Pz))); Showmessage('L2='+FloatToStr((exp(n*ln(c/Pz))))+'млн об/мин'); end; procedure TForm1.Button3Click(Sender: TObject); begin D2:=StrtoFloat(Edit11.text); d:=StrtoFloat(Edit12.text); dt:=0.3*(D2-d); l:=(1.5+1.7)*dt; s:=0.15*(D2-d); d1:=0.5*(D2+d); Showmessage('dt='+FloatToStr(0.3*(D2-d))+'мм'); Showmessage('s='+FloatToStr((0.15*(D2-d)))+'мм'); Showmessage('d1='+FloatToStr(0.5*(D2+d))+'мм'); Showmessage('l='+FloatToStr((1.5+1.7)*dt)+'мм'); end; procedure TForm1.Button4Click(Sender: TObject); var pol: array[1..6] of TPoint; pol2: array[1..6] of TPoint; Begin with Image1.Picture.Bitmap do begin Width:=0; Height:=0; Width:=Image1.Width; Height:=Image1.Width; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clBlack; Rectangle(1+80, 98+80, 7+80, 303+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clBlack; Rectangle(83+80, 98+80, 89+80, 303+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clWhite; Image1.Picture.Bitmap.Canvas.Brush.Style:= bsFDiagonal; RoundRect (0+80, 0+80, 90+80, 100+80, 10, 10); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clWhite; Image1.Picture.Bitmap.Canvas.Brush.Style:= bsFDiagonal; RoundRect (0+80, 300+80, 90+80, 400+80, 10, 10); end; end; Begin With Image1.Canvas do begin pol[1] := Point(1+80,30+80); pol[2] := Point(45+80,30+80); pol[3] := Point(88+80,15+80); pol[4] := Point(88+80,70+80); pol[5] := Point(1+80,70+80); pol[6] := pol[1]; Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clBlack; Image1.Picture.Bitmap.Canvas.Polygon(pol); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psDashDot; MoveTo(0+80,200+80); lineTo(100+80,200+80); end; end; Begin With Image1.Canvas do begin Font.Name := 'Tahoma'; Font.Size := 7; Font.Color := clWhite; Brush.Style :=bsClear; TextOut(40+80, -45+80, '14'); TextOut(-30+80, 200+80, '20'); TextOut(125+80, 200+80, '47'); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psSolid; MoveTo(1+80,10+80); lineTo(1+80,-35+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psSolid; MoveTo(88+80,10+80); lineTo(88+80,-35+80); MoveTo(88+80,0+80); lineTo(115+80,0+80); MoveTo(88+80,397+80); lineTo(115+80,397+80); MoveTo(0+80,300+80); lineTo(-20+80,300+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psSolid; MoveTo(-11+80,-30+80); lineTo(98+80, -30+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psSolid; MoveTo(108+80, -10+80); lineTo(108+80, 404+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psSolid; MoveTo(1+80, 100+80); lineTo(-20+80, 100+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psSolid; MoveTo(-15+80, 100+80); lineTo(-15+80, 303+80); end; end; Begin With Image1.Canvas do begin pol2[1] := Point(1+80,330+80); pol2[2] := Point(88+80,330+80); pol2[3] := Point(88+80,385+80); pol2[4] := Point(45+80,370+80); pol2[5] := Point(1+80,370+80); pol2[6] := pol2[1]; Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clBlack; Image1.Picture.Bitmap.Canvas.Polygon(pol2); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clBlack; Ellipse(13+80, 318+80, 78+80, 383+80); end; end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Brush.Color:=clBlack; Ellipse(13+80, 18+80, 78+80, 83+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psDashDot; MoveTo(45+80,10+80); lineTo(45+80,90+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psDashDot; MoveTo(10+80,50+80); lineTo(85+80,50+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psDashDot; MoveTo(45+80,310+80); lineTo(45+80,390+80); end; end; Begin With Image1.Canvas do begin Image1.Picture.Bitmap.Canvas.Pen.Color:= clWhite; Image1.Picture.Bitmap.Canvas.Pen.Style:=psDashDot; MoveTo(10+80,350+80); lineTo(80+80,350+80); end; end; end; procedure TForm1.Edit11Change(Sender: TObject); begin end; end. |