VBA
1. MS Office, Word, -- .
2. MS Office // Visual Basic.
3. MS VBA Insert-UserForm
4. 4 , , . . , , !
5. , .
6. 10 . ().
7. (Borland C++ Borland Delphi) . , .
1.
x, y. , (x, y) .
-
Visual Basic
,
Caption Label1 x=.
Caption Label2 y=.
Caption Label3 .
Caption CommandButton1 .
:
CommandButton1 :
Private Sub CommandButton1_Click()
x = Val(TextBox1.Text)
y = Val(TextBox2.Text)
If (x ^ 2 + y ^ 2 <= 1) And (x >= 0) Then
Label3.Caption = " "
Else
Label3.Caption = " "
End If
End Sub
: Run Run
Borland C++
#include <iostream.h>
#include <math.h>
int main() {
float x;
float y;
cout << " x y: ";
cin >>x>>y;
if ((x*x+y*y<=1) && (x>=0))
cout << " ";
else
cout << " ";
cout << endl;
return 0;
}
: Run Run
Borland Delphi ( )
Program z1;
Var x,y:real;
Begin
Write( x y: );
Readln(x,y);
If (x*x+y*y<=1) and (x>=0) then
Writeln( ')
else
Writeln( ');
End.
: Run Run
2.
. .
-
|
|
Visual Basic
,
Caption Label1 a=.
Caption Label2 b=.
Caption Label3 h=.
Caption Label4 .
Caption Label5 .
Caption CommandButton1 .
:
CommandButton1 :
Private Sub CommandButton1_Click()
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
h = Val(TextBox3.Text)
Label4.Caption = ""
Label5.Caption = ""
For x = a To b Step h
If x < 3 Then
f = 2 * x ^ 3 - 7 * x ^ 2 + 5 * x + 3
Else
f = x + Log(Abs(Cos(2 * x) - 1))
End If
Label4.Caption = Label4.Caption & Round(x, 2) & Chr(13)
Label5.Caption = Label5.Caption & Round(f, 4) & Chr(13)
Next x
End Sub
: Run Run
Borland C++
#include <iostream.h>
#include <math.h>
int main() {
float a,b,h;
float x,f;
int i;
cout << " a, b h: ";
cin >>a>>b>>h;
cout << "x y";
cout << endl;
for (i=0; i<(b-a)/h; i++) {
x=a+i*h;
if (x<3)
f= 2*x*x*x-7*x*x+5*x+3;
else
f= x+Ln(fAbs(Cos(2*x)-1));
cout << x;
cout << " ";
cout << f;
cout << endl;
}
return 0;
}
: Run Run
Borland Delphi ( )
Program z2;
Var a,b,h,x,f:real;
Begin
Write( a, b h: );
Readln(a,b,h);
For i:=0 to trunc((b-a)/h) do
Begin
x=a+i*h;
if (x<3) then
f= 2*x*x*x-7*x*x+5*x+3
else
f= x+Ln(Abs(Cos(2*x)-1));
Writeln(x= , x, f= , f);
End;
End.
: Run Run