-
private sub command1_click()dim a, b, c, x1, x2, d as singlea = val(
b = val(
c = val(
d = b ^ 2 - 4 * a * cif d > 0 then
x1 = (-b + sqr(d)) / (2 * a)x2 = (-b - sqr(d)) / (2 * a)elseif d = 0 then
x1 = (-b / 2 * a)
x2 = x1
else: msgbox "Equations have no real roots"
end if
x1=" & x1 & "" & "x2=" & x2end sub
Draw four stylistic boxes on the form, and a command button with the following names: text1, text2, text3, text4, commond1
After running the program, enter the values of a, b, and c in the equation in the text boxes text1, text2, and text3 respectively, and the results will be displayed in the text box text4.
-
Create a new project, add 5 text controls, add a button control, and add **:
private sub command1_click()
if (val( *val( -4 * val( *val( = 0 then
val("-" & sqr(val( *val( -4 * val( *val( (2 * val(
val("-" & sqr(val( *val( -4 * val( *val( (2 * val(
elsemsgbox "This quadratic equation has no roots!", vbinformation, "iq"
end if
end sub
where text1 is the quadratic coefficient, text2 is the primary coefficient, text3 is constant, text4 is x1, and text5 is x2Here's a screenshot: You can add some touches. (Note: This program is not implemented to find the imaginary root).
-
This program is not completed by intermediate programmers.
-
The first is called the general formula, the standard form is y=ax +bx+c, as long as you know any 3 points when evaluating, you can get the ternary system of equations to find the analytical formula, which is simpler, and there will be no examples here
The second method is called vertex formula, and the standard form is y=a(x h) 2 c, which is used when one vertex and another point are known
Vertex formula: If the vertex of a quadratic function is (3,5) and (4,0), find its analytic formula
Let the relationship of the function be y a(x h) 2 c, vertices (3,5), and pass the point (4,0), then h 3,c 5, substituting x 4, y 0 can find the value of a, so that its analytic formula can be obtained
Note: If you still don't understand, you can use the following method: because the vertices of the function (3,5), so the symmetry axis of the function is x 3, then the function must pass the symmetry point (2,0) of (4,0), so there are 3 points, which can be solved with the general formula
The third method is called the intersection formula, the standard form is y a(x m)(x n), which is used when there are two intersections and another point of the function and the x-axis in the problem, for example: a quadratic function passes (4,0), (1,0) and (0,3) and finds its analytic formula
Let the function relation be y a(x m)(x n) over (4,0), (1,0) and (0,3), when x 4 y is 0, then (x m) or (x n) must have one of them as 0, let it be (x m) then m 4 In the same way, n 1 then the analytic formula of the original function is y a(x 4)(x 1), substituting x 0, y 3 can be solved
Note: The intersection formula can be found in the general formula, but it is more troublesome
vb wants to control oh add it yourself.
**:private sub command1_click()dim a, b, c, delta, x1, x2, x as double >>>More
An equation that contains only one unknown, and the order of the highest order term containing unknowns is one, is called a univariate equation. >>>More
if (b*b-4*a*c==0)
printf("x1=x2=%.6f",-b/(2*a)); >>>More
Since ac squared = bc times ab, x squared = 1-x solution yields the value of x (take a positive value, the length must be positive). >>>More
1.Set a daily water supply of x 10,000 cubic meters.
3x+x+1/2x+1= >>>More