Инженерный калькулятор

Автор работы: Пользователь скрыл имя, 11 Марта 2013 в 23:18, курсовая работа

Краткое описание

Эволюция технических средств персональных компьютеров привела к повсеместному вытеснению старой “доброй” ОС MS-DOS значительно более мощными системами Windows, программирование для которых существенно сложнее, чем программирование для MS-DOS. В 1993 году Microsoft выпустила первую визуальную среду программирования Visual Basic, и программирование для Windows стало даже проще, чем программирование для MS-DOS. В ответ на это Borland в 1995 году выпустила первую версию Delphi, а затем, с интервалом в 1 год, - еще 4 версии: 2, 3, 4 и 5. Наконец, в середине 2001 г. выпускается версия 6.

Содержание

Введение………………………………………………………………………..…..5
Теоретическая часть……………………………………………………………...10
Описание функций и процедур……………………………………………….....13
Руководство пользователя…………………………………………………….…17
Результат работы программы……………………………………………….…...24
Заключение………………………………………………………………….…….26
Список литературы……

Вложенные файлы: 1 файл

Работа.docx

— 1.65 Мб (Скачать файл)

   k:=k-1

  until k=-1;

 

for i := 0 to StringGrid1.ColCount-1 do

  form5.StringGrid2.Cells[i,0]:=floattostr(x[i]);

 

n:=StringGrid1.RowCount;

case n of

  2: begin

      label3.Caption:=floattostrF(x[0],ffFixed,5,3);

      label4.Caption:=floattostrF(x[1],ffFixed,5,2);

     end;

 

  3: begin

      label3.Caption:=floattostrF(x[0],ffFixed,5,3);

      label4.Caption:=floattostrF(x[1],ffFixed,5,2);

      label5.Caption:=floattostrF(x[2],ffFixed,5,2);

     end;

 

  4: begin

        label3.Caption:=floattostrF(x[0],ffFixed,5,3);

        label4.Caption:=floattostrF(x[1],ffFixed,5,2);

        label5.Caption:=floattostrF(x[2],ffFixed,5,2);

        label6.Caption:=floattostrF(x[3],ffFixed,5,2);

     end;

 

  5: begin

       label3.Caption:=floattostrF(x[0],ffFixed,5,3);

       label4.Caption:=floattostrF(x[1],ffFixed,5,2);

       label5.Caption:=floattostrF(x[2],ffFixed,5,2);

       label6.Caption:=floattostrF(x[3],ffFixed,5,2);

       label7.Caption:=floattostrF(x[4],ffFixed,5,2);

     end;

end;

end;

 

procedure TForm3.Button2Click(Sender: TObject);

begin

  close;

end;

 

procedure TForm3.FormCreate(Sender: TObject);

begin

  label1.Caption:='Введите матрицу:';

  n:=StringGrid1.RowCount;

end;

 

end.

 

{---------------------------------------------------------------------------------}

 

unit Unit4;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, jpeg, ExtCtrls;

 

type

  TForm4 = class(TForm)

    Image1: TImage;

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    Label4: TLabel;

    Label5: TLabel;

    Label6: TLabel;

    Button1: TButton;

    procedure Button1Click(Sender: TObject);

    procedure FormShow(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form4: TForm4;

 

implementation

 

{$R *.dfm}

 

procedure TForm4.Button1Click(Sender: TObject);

begin

close;

end;

 

procedure TForm4.FormShow(Sender: TObject);

begin

AnimateWindow(form4.Handle, 90, aw_blend);

form4.Show

end;

 

end.

 

 

{---------------------------------------------------------------------------------}

 

 

unit Unit5;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, XPMan, Menus, ExtCtrls, StdCtrls, Grids, Buttons, jpeg,ClipBrd,unit4;

 

type

  TForm5 = class(TForm)

    Label1: TLabel;

    Image2: TImage;

    SpeedButton7: TSpeedButton;

    SpeedButton8: TSpeedButton;

    SpeedButton9: TSpeedButton;

    SpeedButton6: TSpeedButton;

    SpeedButton5: TSpeedButton;

    SpeedButton4: TSpeedButton;

    SpeedButton1: TSpeedButton;

    SpeedButton2: TSpeedButton;

    SpeedButton3: TSpeedButton;

    SpeedButtonPlusMinus: TSpeedButton;

    SpeedButton0: TSpeedButton;

    SpeedButtonT: TSpeedButton;

    SpeedButtonUmn: TSpeedButton;

    SpeedButtonDel: TSpeedButton;

    SpeedButtonMinus: TSpeedButton;

    SpeedButtonPlus: TSpeedButton;

    SpeedButtonRavno: TSpeedButton;

    SpeedButtonX2: TSpeedButton;

    SpeedButtonSqrt: TSpeedButton;

    SpeedButtonBack: TSpeedButton;

    SpeedButtonCE: TSpeedButton;

    SpeedButtonCL: TSpeedButton;

    SpeedButtonProcent: TSpeedButton;

    SpeedButtonMS: TSpeedButton;

    SpeedButtonMR: TSpeedButton;

    SpeedButtonMC: TSpeedButton;

    SpeedButtonMplus: TSpeedButton;

    StringGrid1: TStringGrid;

    StringGrid2: TStringGrid;

    Memo1: TMemo;

    Panel5: TPanel;

    MainMenu1: TMainMenu;

    Pravka: TMenuItem;

    Copy: TMenuItem;

    Insert: TMenuItem;

    Vid: TMenuItem;

    Ingener: TMenuItem;

    Standart: TMenuItem;

    N2: TMenuItem;

    N1: TMenuItem;

    XPManifest1: TXPManifest;

    Image1: TImage;

    procedure SpeedButton8Click(Sender: TObject);

    procedure FormCreate(Sender: TObject);

    procedure SpeedButton7Click(Sender: TObject);

    procedure SpeedButton9Click(Sender: TObject);

    procedure SpeedButton6Click(Sender: TObject);

    procedure SpeedButton5Click(Sender: TObject);

    procedure SpeedButton4Click(Sender: TObject);

    procedure SpeedButton3Click(Sender: TObject);

    procedure SpeedButton2Click(Sender: TObject);

    procedure SpeedButton1Click(Sender: TObject);

    procedure SpeedButton0Click(Sender: TObject);

    procedure FormClose(Sender: TObject; var Action: TCloseAction);

    procedure SpeedButtonMSClick(Sender: TObject);

    procedure SpeedButtonMRClick(Sender: TObject);

    procedure SpeedButtonMCClick(Sender: TObject);

    procedure SpeedButtonMplusClick(Sender: TObject);

    procedure SpeedButtonBackClick(Sender: TObject);

    procedure SpeedButtonCEClick(Sender: TObject);

    procedure SpeedButtonCLClick(Sender: TObject);

    procedure SpeedButtonSqrtClick(Sender: TObject);

    procedure SpeedButtonX2Click(Sender: TObject);

    procedure SpeedButtonTClick(Sender: TObject);

    procedure SpeedButtonPlusMinusClick(Sender: TObject);

    procedure SpeedButtonPlusClick(Sender: TObject);

    procedure Memo1Change(Sender: TObject);

    procedure SpeedButtonMinusClick(Sender: TObject);

    procedure SpeedButtonDelClick(Sender: TObject);

    procedure SpeedButtonUmnClick(Sender: TObject);

    procedure SpeedButtonRavnoClick(Sender: TObject);

    procedure IngenerClick(Sender: TObject);

    procedure N2Click(Sender: TObject);

    procedure CopyClick(Sender: TObject);

    procedure InsertClick(Sender: TObject);

    procedure FormShow(Sender: TObject);

    procedure N1Click(Sender: TObject);

    procedure SpeedButtonProcentClick(Sender: TObject);

    procedure SpeedButton7MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton8MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton9MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton4MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton5MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton6MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton2MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton3MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton0MouseMove(Sender: TObject; Shift: TShiftState; X,

      Y: Integer);

    procedure SpeedButton0MouseLeave(Sender: TObject);

    procedure SpeedButton3MouseLeave(Sender: TObject);

    procedure SpeedButton2MouseLeave(Sender: TObject);

    procedure SpeedButton1MouseLeave(Sender: TObject);

    procedure SpeedButton6MouseLeave(Sender: TObject);

    procedure SpeedButton5MouseLeave(Sender: TObject);

    procedure SpeedButton4MouseLeave(Sender: TObject);

    procedure SpeedButton9MouseLeave(Sender: TObject);

    procedure SpeedButton8MouseLeave(Sender: TObject);

    procedure SpeedButton7MouseLeave(Sender: TObject);

    procedure FormKeyPress(Sender: TObject; var Key: Char);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form5: TForm5;  flag:boolean; mem_S:real; prk:integer;

 

implementation

 

{$R *.dfm}

uses  unit1,unit2,unit3;

 

procedure TForm5.CopyClick(Sender: TObject);

begin

memo1.SelectAll;

memo1.CopyToClipboard;

flag:=true;

end;

 

procedure TForm5.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form1.Close;

end;

 

procedure TForm5.FormCreate(Sender: TObject);

begin

memo1.Text:='0'; flag:=true;

end;

 

procedure TForm5.FormKeyPress(Sender: TObject; var Key: Char);

begin

CASE key of

    #27: begin SpeedButtonCLClick(SpeedButtonCL); key:=#0; end;

   '1': begin SpeedButton1Click(SpeedButton1); key:=#0;   end;

   '2': begin SpeedButton2Click(SpeedButton2); key:=#0;   end;

   '3': begin SpeedButton3Click(SpeedButton3); key:=#0;   end;

   '4': begin SpeedButton4Click(SpeedButton4); key:=#0;   end;

   '5': begin SpeedButton5Click(SpeedButton5); key:=#0;   end;

   '6': begin SpeedButton6Click(SpeedButton6); key:=#0;   end;

   '7': begin SpeedButton7Click(SpeedButton7); key:=#0;   end;

   '8': begin SpeedButton8Click(SpeedButton8); key:=#0;   end;

   '9': begin SpeedButton9Click(SpeedButton9); key:=#0;   end;

   '0': begin SpeedButton0Click(SpeedButton0); key:=#0;   end;

   '+':  SpeedButtonPlusClick(SpeedButtonPlus);

   '-':  SpeedButtonMinusClick(SpeedButtonMinus);

   '*':  SpeedButtonUmnClick(SpeedButtonUmn);

   '/':  SpeedButtonDelClick(SpeedButtonDel);

   #13:  SpeedButtonRavnoClick(SpeedButtonRavno);

   #96:  SpeedButtonSqrtClick(SpeedButtonSqrt);

   #92:  SpeedButtonPlusMinusClick(SpeedButtonPlusMinus);

   #46:  SpeedButtonTClick(SpeedButtonT);

   #64 : SpeedButtonX2Click(SpeedButtonX2);

   #08 : SpeedButtonBackClick(speedbuttonBack);

END;

end;

 

procedure TForm5.FormShow(Sender: TObject);

begin

  AnimateWindow(form5.Handle, 90, aw_blend);

  form5.Show

end;

 

procedure TForm5.IngenerClick(Sender: TObject);

begin

Form1.Show; Form5.hide;

end;

 

procedure TForm5.InsertClick(Sender: TObject);

begin

memo1.Text:=Clipboard.AsText;

try

  memo1.Text:=inttostr(strtoint(memo1.Text));

except

  memo1.Text:='0';

end;

end;

 

procedure TForm5.Memo1Change(Sender: TObject);

begin

  kol:=1;

end;

 

procedure TForm5.N1Click(Sender: TObject);

begin

Form4.ShowModal;

end;

 

procedure TForm5.N2Click(Sender: TObject);

var

     sms:string; col:integer;

begin

sms:=InputBox('Решение СЛАУ','Введите  количество неизвестных (х)','');

try

  col:=strtoint(sms);

except

end;

if (col>1) and (col<=5)  then

BEGIN

form3.StringGrid1.ColCount:=col+1;

form3.StringGrid1.RowCount:=col;

 

case col of

  2: begin

       form3.StringGrid1.Width:=137;     form3.StringGrid1.Height:=58;

       form3.Button1.Top:=113;           form3.Button1.Left:=150;

       form3.Label1.Font.Size:=10;       form3.Label2.Font.Size:=10;

       form3.Label2.Top:=13;             form3.Label2.Left:=150;

       form3.Label3.Top:=40;             form3.Label3.Left:=185;

       form3.Label4.Top:=59;             form3.Label4.Left:=185;

       form3.Label5.visible:=false;      form3.Label6.visible:=false;;

       form3.Width:=250;                 form3.Height:=173;

        end;

  3: begin

       form3.StringGrid1.Width:=181;     form3.StringGrid1.Height:=85;

       form3.Button1.Top:=139;           form3.Button1.Left:=200;

       form3.Label1.Font.Size:=12;       form3.Label2.Top:=17;

       form3.Label2.Left:=200;           form3.Label3.Top:=54;

       form3.Label3.Left:=224;           form3.Label4.Top:=73;

       form3.Label4.Left:=224;           form3.Label5.Top:=92;

       form3.Label5.Left:=224;           form3.Width:=300;

       form3.Label5.visible:=true;       form3.Label6.visible:=false;

       form3.Height:=198;

     end;

  4: begin

       form3.StringGrid1.Width:=223;      form3.StringGrid1.Height:=112;

       form3.Button1.Top:=162;            form3.Button1.Left:=256;

       form3.Label1.Font.Size:=12;        form3.Label2.Top:=17;

       form3.Label2.Left:=256;            form3.Label3.Top:=54;

       form3.Label3.Left:=283;            form3.Label4.Top:=73;

       form3.Label4.Left:=283;            form3.Label5.Top:=92;

       form3.Label5.Left:=283;            form3.Label6.Top:=111;

       form3.Label6.Left:=283;            form3.Width:=353;

       form3.Label5.visible:=true;        form3.Label6.Visible:=true;

       form3.Label7.Visible:=false;       form3.Height:=225;

       end;

  5: begin

       form3.StringGrid1.Width:=269;      form3.StringGrid1.Height:=139;

       form3.Button1.Top:=186;            form3.Button1.Left:=296;

       form3.Label1.Font.Size:=12;        form3.Label2.Top:=17;

       form3.Label2.Left:=296;            form3.Label3.Top:=46;

       form3.Label3.Left:=331;            form3.Label4.Top:=65;

       form3.Label4.Left:=331;            form3.Label5.Top:=84;

       form3.Label5.Left:=331;            form3.Label6.Top:=103;

       form3.Label6.Left:=331;            form3.Label7.Visible:=true;

       form3.Label7.Left:=331;            form3.Label7.top:=122;

       form3.Label5.visible:=true;        form3.Width:=401;

       form3.Height:=251;

       end;

 

end;

Form3.ShowModal;        END;

 

end;

 

procedure TForm5.SpeedButton0Click(Sender: TObject);

begin

if flag=true then  memo1.clear; memo1.Text:=memo1.Text+'0'; flag:=false;

  if ss=10 then

   begin

      if (strtofloat(memo1.Text)=0) then begin memo1.Text:='0';

      if nol<>'z' then

       flag:=true else flag:=false; end;

   end;

end;

 

procedure TForm5.SpeedButton0MouseLeave(Sender: TObject);

begin

  SpeedButton0.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton0MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton0.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton1Click(Sender: TObject);

begin

  if flag=true then memo1.Clear;

  memo1.Text:=memo1.Text+'1';  flag:=false;

end;

 

procedure TForm5.SpeedButton1MouseLeave(Sender: TObject);

begin

  SpeedButton1.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton1.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton2Click(Sender: TObject);

begin

  if flag=true then memo1.clear;

  memo1.Text:=memo1.Text+'2';  flag:=false;

end;

 

procedure TForm5.SpeedButton2MouseLeave(Sender: TObject);

begin

  SpeedButton2.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton2MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton2.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton3Click(Sender: TObject);

begin

  if flag=true then memo1.clear;

  memo1.Text:=memo1.Text+'3';  flag:=false;

end;

 

procedure TForm5.SpeedButton3MouseLeave(Sender: TObject);

begin

  SpeedButton3.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton3MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton3.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton4Click(Sender: TObject);

begin

if flag=true then memo1.clear;

  memo1.Text:=memo1.Text+'4'; flag:=false;

end;

 

procedure TForm5.SpeedButton4MouseLeave(Sender: TObject);

begin

  SpeedButton4.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton4MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton4.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton5Click(Sender: TObject);

begin

  if flag=true then  memo1.clear;

  memo1.Text:=memo1.Text+'5'; flag:=false;

end;

 

procedure TForm5.SpeedButton5MouseLeave(Sender: TObject);

begin

  SpeedButton5.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton5MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton5.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton6Click(Sender: TObject);

begin

if flag=true then memo1.clear;

  memo1.Text:=memo1.Text+'6'; flag:=false;

end;

 

procedure TForm5.SpeedButton6MouseLeave(Sender: TObject);

begin

  SpeedButton6.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton6MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton6.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton7Click(Sender: TObject);

begin

  if flag=true then memo1.clear;

    memo1.Text:=memo1.Text+'7'; flag:=false;

end;

 

procedure TForm5.SpeedButton7MouseLeave(Sender: TObject);

begin

  SpeedButton7.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton7MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton7.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton8Click(Sender: TObject);

begin

  if flag=true then memo1.clear;

    memo1.Text:=memo1.Text+'8'; flag:=false;

end;

 

procedure TForm5.SpeedButton8MouseLeave(Sender: TObject);

begin

  SpeedButton8.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton8MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton8.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButton9Click(Sender: TObject);

begin

  if flag=true then memo1.clear;

   memo1.Text:=memo1.Text+'9'; flag:=false;

end;

 

procedure TForm5.SpeedButton9MouseLeave(Sender: TObject);

begin

  SpeedButton9.Font.Color:=clblack;

end;

 

procedure TForm5.SpeedButton9MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);

begin

  SpeedButton9.Font.Color:=clblue;

end;

 

procedure TForm5.SpeedButtonBackClick(Sender: TObject);

var l,p:integer;  s:string;

begin

  s:='';  s:=memo1.Text;    l:=length(s);

  if l>1 then

   begin

    s[l]:=' ';

    p:=pos(' ',s);

    delete(s,p,1);

     memo1.Text:=s;

   end

  else if l=1 then

    begin s[1]:='0'; memo1.Text:=s; end;

  if memo1.Text='0' then flag:=true;

end;

 

procedure TForm5.SpeedButtonCEClick(Sender: TObject);

begin

  Memo1.text:='0';

  flag:=true;

end;

 

procedure TForm5.SpeedButtonCLClick(Sender: TObject);

begin

Memo1.text:='0';

a:=0; b:=0; c:=0; m:=0; d:=0; u:=0;

mk:=0; uk:=0; pk:=0; dk:=0;

kol:=0; R:=0;

mem_s:=0;

panel5.Caption:='';

flag:=true;

end;

 

procedure TForm5.SpeedButtonDelClick(Sender: TObject);

begin

if kol=1 then

  BEGIN

   if (klav='m') then

    begin

      memo1.Text:=floattostr((r-strtofloat(memo1.text)));

      R:=0; pk:=0; mk:=0; dk:=0; uk:=0;

    end;

 

    if (klav='u') then

    begin

      memo1.Text:=floattostr(r*strtofloat(memo1.Text));

Информация о работе Инженерный калькулятор