Anonymous
Anonymous asked in 電腦與網際網路程式設計 · 1 decade ago

依以下題目寫出ASP的完整程式!

兌幣機會依序兌換10元,5元,1元硬幣.請使用程式計算173元可兌換多少個10元,5元,1元硬幣? (使用Visual Web Developer寫出完整程式)

1 Answer

Rating
  • 1 decade ago
    Favorite Answer

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona...

    <script runat="server">

    Const Ten As Integer = 10

    Const Five As Integer = 5

    Const One As Integer = 1

    Sub btn_Caculator_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Caculator.Click

    Dim Count As Integer = Val(txCount.Text)

    Dim TenCoin, FiveCoin, OneCoin As Integer

    TenCoin = Count \ Ten

    Count = Count Mod Ten

    FiveCoin = Count \ Five

    Count = Count Mod Five

    OneCoin = Count

    laTen.Text = TenCoin

    laFive.Text = FiveCoin

    laOne.Text = OneCoin

    End Sub

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">

    <title>未命名頁面</title>

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

    <table style="border:1px; border-color:Blue">

    <tr>

    <td>總金額</td><td><asp:TextBox ID="txCount" runat="server"></asp:TextBox></td>

    </tr>

    <tr>

    <td>10元個數</td><td><asp:Label ID="laTen" runat="server"></asp:Label></td>

    </tr>

    <tr>

    <td>5元個數</td><td><asp:Label ID="laFive" runat="server"></asp:Label></td>

    </tr>

    <tr>

    <td>1元個數</td><td><asp:Label ID="laOne" runat="server"></asp:Label></td>

    </tr>

    <tr>

    <td>計算</td><td><asp:Button ID="btn_Caculator" runat="server" Text="計算"/></td>

    </tr>

    </table>

    </div>

    </form>

    </body>

    </html>

    Source(s): me
Still have questions? Get your answers by asking now.