10.07.2006
|
#4 (permalink)
|
Üyelik Tarihi: 21.04.2006
Yer: İstanbul
Yaş: 28
Mesaj: 394
|
Re: (ASP) Matematiksel işlemler yapmak ?
Sizin için kısa bir kod yazdım umarım işinizi görür.
Mat. ASP nin içeriği
<%
Dim a, b, islem
If Len(Request("sayi1")) <> 0 And Len(Request("sayi2")) <> 0 And Len(Request("sayi1")) <> 0 Then
a=CInt(Request("sayi1")) : b=CInt(Request("sayi2")) : islem = CInt(Request("islem"))
Response.Write "Sonuç : " & Mat(a,b,islem)
End If
%>
<form action="Mat.ASP" method="get">
<input type="text" name="sayi1" value="<%=a%>">
<select name="islem">
<option value="1"<% If islem = 1 Then Response.Write " Selected"%>>Topla</option>
<option value="2"<% If islem = 2 Then Response.Write " Selected"%>>Çıkar</option>
<option value="3"<% If islem = 3 Then Response.Write " Selected"%>>Çarp</option>
<option value="4"<% If islem = 4 Then Response.Write " Selected"%>>Böl</option>
</select>
<input type="text" name="sayi2" value="<%=b%>">
<input type="submit" value="Hesapla">
</form>
<%
Function Mat(a,b,islem)
Dim toplam, fark, carpim, bolum
IF islem = 1 Then
sonuc=CInt(a+b)
ElseIF islem = 2 Then
sonuc=CInt(a-b)
ElseIF islem = 3 Then
sonuc=CInt(a*b)
ElseIF islem = 4 Then
sonuc=CDbl(a/b)
Else
sonuc="Hata"
End IF
Mat = sonuc
End Function
%>
|
|
|