zoukankan      html  css  js  c++  java
  • 综合利用数组以及条件分支计算一个班级的成绩

    <%@ Page Language="vb" Debug="true" ContentType="text/html" ResponseEncoding="gb2312" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>综合利用数组以及条件分支计算一个班级的成绩</title>
    <script language="vb" runat="server">
    sub page_load()
    dim you,liang,cha,jihao,i,you2,liang2,cha2,jihao2,sum,avg as integer
    you=0
    liang=0
    cha=0
    jihao=0
    you2=0
    liang2=0
    cha2=0
    jihao2=0
    sum=0
    avg=0
    dim arr() as integer={9,8,10,12,14,15,20,40,50,51,53,62,68,70,73,74,75,81,83,89,86,90,93,94,96,97,98,100}
    for i=0 to arr.length-1
     select case arr(i)
      case 0 to 60
       cha2+=arr(i)
       cha+=1
       lbl.text="成绩很差的共有:"& cha & "位同学,总成绩是:" & cha2 & "分,平均分:" & cha2/cha & "分"
      case 61 to 75
       liang2+=arr(i)
       liang+=1
       lbl1.text="成绩一般的共有:"& liang & "位同学,总成绩是:" & liang2 & "分,平均分:" & liang2/liang & "分"
      case 76 to 90
       jihao2+=arr(i)
       jihao+=1
       lbl2.text="成绩比较好的共有:"& jihao & "位同学,总成绩是:" & jihao2 & "分,平均分:" & jihao2/jihao & "分"
       case 91 to 100
       you2+=arr(i)
       you+=1
       lbl3.text="成绩优秀的共有:"& you & "位同学,总成绩是:" & you2 & "分,平均分:" & you2/you & "分"  
     end select
     sum+=arr(i)
     avg+=1
     next i
    lbl4.text="全班共有:"& arr.length & "位同学,总成绩是:" & sum & "分,平均分:" & sum/avg & "分"
    end sub
    </script>
    <body>
    <asp:Label ID="lbl4" runat="server"/><br>
    <asp:Label ID="lbl" runat="server"/><br>
    <asp:Label ID="lbl1" runat="server"/><br>
    <asp:Label ID="lbl2" runat="server"/><br>
    <asp:Label ID="lbl3" runat="server"/><br>
    </body>
    </html>
  • 相关阅读:
    Trapping Rain Water
    Construct Binary Tree from Preorder and Inorder Traversal
    Flatten Binary Tree to Linked List
    Permutations II
    Unique Paths II
    Path Sum II
    Unique Binary Search Trees II
    evdev module-----uinput.py
    evdev module-----events.py
    evdev module-----device.py
  • 原文地址:https://www.cnblogs.com/thcjp/p/334697.html
Copyright © 2011-2022 走看看