📄 unmatrix.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "unMatrix.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFrMatrix *FrMatrix;
//---------------------------------------------------------------------------
__fastcall TFrMatrix::TFrMatrix(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFrMatrix::btnescClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TFrMatrix::btnOKClick(TObject *Sender)
{
double a11,a12,a21,a22;
double b11,b12,b21,b22;
double c11,c12,c21,c22;
a11=StrToFloat(eda11->Text);
a12=StrToFloat(eda12->Text);
a21=StrToFloat(eda21->Text);
a22=StrToFloat(eda22->Text);
b11=StrToFloat(edb11->Text);
b12=StrToFloat(edb12->Text);
b21=StrToFloat(edb21->Text);
b22=StrToFloat(edb22->Text);
c11=a11*b11+a12*b21;
c12=a11*b12+a12*b22;
c21=a21*b11+a22*b21;
c22=a21*b12+a22*b22;
Application->MessageBoxA(("矩阵相乘的计算结果是:\r\n"
+FloatToStr(c11)+"\t"+FloatToStr(c12)+"\r\n"
+FloatToStr(c21)+"\t"+FloatToStr(c22)).c_str(),"答案",64);
edc11->Text=FloatToStr(c11);
edc12->Text=FloatToStr(c12);
edc21->Text=FloatToStr(c21);
edc22->Text=FloatToStr(c22);
}
//---------------------------------------------------------------------------
void __fastcall TFrMatrix::eda11Change(TObject *Sender)
{
/* if(eda11->Text.Trim().IsEmpty()||
eda12->Text.Trim().IsEmpty()||
eda21->Text.Trim().IsEmpty()||
eda22->Text.Trim().IsEmpty()||
edb11->Text.Trim().IsEmpty()||
edb12->Text.Trim().IsEmpty()||
edb21->Text.Trim().IsEmpty()||
edb22->Text.Trim().IsEmpty())
{
btnOK->Enabled=0;
}
else
{
btnOK->Enabled=1;
} */
btnOK->Enabled=!(eda11->Text.Trim().IsEmpty()||
eda12->Text.Trim().IsEmpty()||
eda21->Text.Trim().IsEmpty()||
eda22->Text.Trim().IsEmpty()||
edb11->Text.Trim().IsEmpty()||
edb12->Text.Trim().IsEmpty()||
edb21->Text.Trim().IsEmpty()||
edb22->Text.Trim().IsEmpty()) ;
}
//---------------------------------------------------------------------------
void __fastcall TFrMatrix::FormCloseQuery(TObject *Sender, bool &CanClose)
{
String a="确定关闭? ";
CanClose=(Application->MessageBoxA(a.c_str(),"提示",36)==6);
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -