View Single Post
Sponsorlu Bağlantılar
Zoque.Forum
Advertisement
Old 10.07.2006   #4 (permalink)
tesera
 
tesera's Avatar
 
Üyelik Tarihi: 21.04.2006
Yer: İstanbul
Yaş: 28
Mesaj: 394
Görsel: 28
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

PHP Code:
<%
Dim abislem

If Len(Request("sayi1")) <> 0  And Len(Request("sayi2")) <> 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.ASPmethod="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 toplamfarkcarpimbolum

        
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
%> 
__________________
Savaş çıkınca, ilk ölen gerçektir.

Tesera Fotograf Sergisi
tesera şu an çevrimdışı   Mesajdan alıntı yaparak yeni bir cevap ekleyin