Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Додаток Г

Код програми проєкту C++


//-----------------------------------------------------------------
#include <vcl.h>
#include <math.h>
#pragma hdrstop
#include "Unit1.h"
//-----------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//-----------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {
Form1->Caption = "Program_17";
}
//-----------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender) {
int y, x = StrToInt(Edit1->Text);
y = 9 * pow(x, 3) - 3 * pow(x, 2) + 5 * x + 7;
Edit2->Text = IntToStr(y);
}
//-----------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender){
int y, x = StrToInt(Edit1->Text);
asm {
mov eax, x
imul eax
push eax
imul x
imul eax, 9
pop ecx
imul ecx, 3
sub eax, ecx
mov ecx, x
imul ecx, 5
add eax, ecx
add eax, 7
mov y, eax
}
Edit3->Text = IntToStr(y);
}
//-----------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender){
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
}
//-----------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender){
Form1->Close();
}
//-----------------------------------------------------------------

You might also like