PDA

View Full Version : Nhờ xem giùm, lỗi chỗ nào vậy mà nó không work?



fx500a
29-02-2004, 19:20
giaiphuongtrinh.htm

<html><head><title>Giai phuong trinh bac 2</title>
</head>
<body>
<h4 align="center">Giai phuong trinh bac 2</h4>
<form action="giaiphuongtrinh.asp" method="post">
<table width="40%" align="center" border="0">
<tr><td>He so a:</td><td><input type="text" name="a"></td></tr>
<tr><td>He so b:</td><td><input type="text" name="b"></td></tr>
<tr><td>He so c:</td><td><input type="text" name="c"></td></tr>
<tr>
<input type="submit" value="Giai phuong trinh"></tr>
</table>
</form>
</body>
</html><noembed>

giaiphuongtrinh.asp


<% Option Explicit %>
<html>
<head><title>Giai phuong trinh bac 2</title></head>
<body>
<%
Dim a, b, c, delta, x, x1, x2
a = Request.Form("a")
b = Request.Form("b")
c = Request.Form("c")
delta = b^2 - (4*a*c)
x = -b/(2*a)
x1 = Round((-b + sqr(delta))/(2*a), 6)
x2 = Round((-b - sqr(delta))/(2*a), 6)
If delta<0 Then
Response.Write("Ph***432;***417;ng trinh vo nghi***7879;m")
ElseIf delta=0 Then
Response.Write("Ph***432;***417;ng trinh co nghi***7879;m kep x = "&x)
Else
Response.Write("Ph***432;***417;ng trinh co hai nghi***7879;m phan bi***7879;t x<sub>1</sub> = "&x1&"va x<sub>2</sub> = "&x2)
End If
Response.Write("<br><br>")
Response.Write("<a href="giaiphuongtrinh.htm">Gi***7843;i ph***432;***417;ng trinh khac</a>")
%>
</body>
</html><noembed>


Em chỉ mới thử lần đầu, mong các huynh giúp đỡ

haiboss
01-03-2004, 03:06
kiểm tra lại sqr và response.write

fx500a
01-03-2004, 22:46
Có phải sau sqr phải luôn luôn là một số? cái response.write bị làm sao bác?

haiboss
05-03-2004, 15:02
xem lại b^2 là cái gì :b*b

xem lai khai báo kiểu của biến :nó báo lỗi Overflow
response.write bỏ dấu ( )