Visual_Basic 板


LINE

※ 引述《Firedance (迎火飞舞)》之铭言: : ※ 引述《Firedance (迎火飞舞)》之铭言: : : 标题: Re: [ASP.NET ] 一个2维阵列的问题.. : : 时间: Wed Nov 1 02:40:20 2006 : : 推 commiserate:有错误讯息吗?版本? 11/01 08:51 : 是我宣告变数值宣告错了, : 我是用Visual Studio 2005(语言用VB)写的 : 我後来把程式改了一下..如下面网址.. : http://www.chinesefreewebs.com/chiahung/asp/2array1.txt : 先将A(1,1).A(1,2)的值加起来然後让平均产生在最右边. : 但我想说如果要让平均产生在最下面的话 : 就必需要先产生 : A(1,1).A(1,2) : A(2,1).A(2,2) : . : . : . : 的数字,然後在将 A(1,1).A(2,1).A(N.1)的值加起来平均放到下面 : A(1,1). : A(2,1). : A(3,1) : 平均 : 就因为想放到下面我就写不出来了..我都是在纸上先写出来然後 : 在去想要怎麽写,可是这个我先将分数产生出来之後却不知道如 : 何加程式码.. : 想说将Total += A(I,J)改成 Total += A(I,1),但好像也不行. : 请问有人知道如何修改的吗?? : 请问有人知道要怎麽写的呢? 我就直接改你的程式码罗 标黄色是我加上去的 标蓝色是我没用到的部分 就是产生成绩再画表格 请享用 Dim Students As Integer = Microsoft.VisualBasic.Interaction.InputBox("请输入学生人数") Dim Subject As Integer = Microsoft.VisualBasic.Interaction.InputBox("请输入学习科目数量") Dim A(Students, Subject), I, J As Int16, Total As Int64, Value As String, Ave, Average, Valuer As Single Dim RandomNumber As Random = New Random '自此开始为新增 Dim total_Student(Students) As Double, total_Subject(Subject) As Double For I = 1 To Students For J = 1 To Subject A(I, J) = RandomNumber.Next(0, 101) total_Student(I) += A(I, J) total_Subject(J) += A(I, J) Next Next '自此结束为新增 Response.Write("<title>计算平均分数</title><center><table border='1' cellpadding='2' width='600' cellspacing='2'>") Valuer = 0 For I = 1 To Students Response.Write("<tr>") 'Total = 0 For J = 1 To Subject 'A(I, J) = RandomNumber.Next(0, 101) 'Total += A(I, J) If A(I, J) >= 60 Then Value = "<font color=blue>" & A(I, J) & "</font>" Else Value = "<font color=red>" & A(I, J) & "</font>" End If Response.Write("<td>" & "No" & I & "=" & Value & "</td>") Next 'Ave = Math.Round(Total / Subject, 1) Ave = total_Student(I) / Subject '新增 Valuer += Ave If Ave >= 60 Then Response.Write("<td>平均:<font color='blue'>" & Ave & "</font></td>") Else Response.Write("<td>平均:<font color='red'>" & Ave & "</font></td>") End If Next '自此开始为新增 Response.Write("<tr>") For J = 1 To Subject Ave = total_Subject(J) / Students If Ave >= 60 Then Response.Write("<td>平均:<font color='blue'>" & Ave & "</font></td>") Else Response.Write("<td>平均:<font color='red'>" & Ave & "</font></td>") End If Next '自此结束为新增 Average = Math.Round(Valuer / Students, 1) Response.Write("<td><font color='Green'>总平均:" & Average & "</font></td>") '新增 Response.Write("<font color='Green'>" & "求每位学生平均分数 <br>" & "</font><br>") Response.Write("<tr align='center'><td colspan='" & Subject + 1 & "'><font color='Green'>" & Students & "位学生平均分数为:" & Average & "</font></td></tr>") Response.Write("</table><br><font color='blue'>考试科目数:" & Subject & " 学生人数:" & Students & "</font></center>") --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.63.21.245







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Boy-Girl站内搜寻

TOP