5-misol: Asosiy matematik operatorlar ishlatilgan loyiha
Quyidagi turdagi formani yaratingiz:
Operatorlar
Bajariladigan amallar
+
Qo‘shish
-
Ayirish
*
Ko‘paytirish
/
Bo‘lish
\
Butun sonli bo‘lish
mod
Qoldiq
/\
Darajaga oshirish
PDF created with pdfFactory trial version
www.pdffactory.com
10.11-rasm
Ob’yekt
Xossa
O‘rnatilgan qiymatlari
Form1
Caption
Matematik amallarni bajarish
Label1
Caption
Font
BackColor
Butun a ni kiriting
Label2
Caption
Font
BackColor
Butun b ni kiriting
Label3
Caption
Font
BackColor
Haqiqiy x ni kiriting
Label4
Caption
Font
BackColor
Haqiqiy y ni kiriting
Label5
Caption
Font
BackColor
BUTUN
Label6
Caption
Font
BackColor
HAQIQIY
Label7
Caption
Font
BackColor
YIG‘INDI
Label8
Caption
Font
BackColor
AYIRMA
Label9
Caption
Font
BackColor
KO‘PAYTMA
Label10
Caption
Font
BackColor
BO‘LINMA
Label11
Caption
Font
BackColor
BUTUN SONLI BO‘LINMA
Label12
Caption
Font
BackColor
QOLDIQ
Label13
Caption
Font
BackColor
SONNING KUBI
PDF created with pdfFactory trial version
www.pdffactory.com
Label14
Caption
Font
BackColor
KUBIK ILDIZ
Command1
Caption
Amallar natijasi
Command2
Caption
Yakunlash
Text1, Text2,
Text3, Text4,
Text5, Text6,
Text7, Text8,
Text9, Text10,
Text11,
Text12,
Text13,
Text14,
Text15,
Text16,
Text17,
Text18,
Text19, Text20
Text
Text xossasi maydonini
tozalash
Dastur kodi
Option Explicit
Private Sub Command1_Click()
Dim inta As Integer, intb As Integer
Dim dblx As Double, dbly As Double
Dim intsum As Integer, intsubstr As Integer
Dim intmult As Integer, intdiv As Integer
Dim intmod As Integer, intsqr As Integer
Dim dblsum As Double, dblsubstr As Double
Dim dblmult As Double, dbldiv As Double
Dim dblsqr As Double, dblsqrt As Double
Dim dbldiv1 As Double, dblsqrt1 As Double
inta = Val(Text1.Text)
intb = Val(Text2.Text)
dblx = Val(Text3.Text)
dbly = Val(Text4.Text)
intsum = inta + intb
intsubstr = inta - intb
intmult = inta * intb
dbldiv1 = inta / intb
intdiv = inta \ intb
intmod = inta Mod intb
intsqr = inta ^ 3
dblsqrt1 = inta ^ (1 / 3)
dblsum = dblx + dbly
dblsubstr = dblx - dbly
dblmult = dblx * dbly
dbldiv = dblx / dbly
dblsqr = dblx ^ 3
dblsqrt = dblx ^ (1 / 3)
PDF created with pdfFactory trial version
www.pdffactory.com
Text5.Text = Str(intsum)
Text7.Text = Str(intsubstr)
Text9.Text = Str(intmult)
Text11.Text = Str(dbldiv1)
Text13.Text = Str(intdiv)
Text15.Text = Str(intmod)
Text17.Text = Str(intsqr)
Text19.Text = Str(dblsqrt1)
Text6.Text = Str(dblsum)
Text8.Text = Str(dblsubstr)
Text10.Text = Str(dblmult)
Text12.Text = Str(dbldiv)
Text18.Text = Str(dblsqr)
Text20.Text = Str(dblsqrt)
End Sub
Private Sub Command2_Click()
End
End Sub
10.12-rasm
PDF created with pdfFactory trial version
www.pdffactory.com
10.13-rasm
Do'stlaringiz bilan baham: |