作者TWTC (優羅志大學學生代表)
看板Visual_Basic
標題[ASP.net ] 請教counter問題?
時間Wed Nov 22 19:32:44 2006
1.想要在網址上讀入一個變數 n 接著按enter
2.重複執行step1 五次 (n這個變數不變)
3.最後第五次 會秀出 前面輸入四次的(包括第五次的值)之總和
我一直無法得到正確的解答..小弟寫的程式如下..
懇請各位先進的指導.. 謝謝
<%
Dim x as integer
Dim tot as integer
tot=0
x=0
Dim arry(4)
while x<4
arry(x) = Cint(request("n"))
x=x+1
response.write(arry(x) & "<br>")
end while
for x=0 to 4
tot = tot+arry(x)
next
response.write(tot)
%>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.249.8.124
推 retsamsu:應該要用Session存吧? 11/22 23:14
推 retsamsu:對不起看錯了@@ 11/22 23:22
→ retsamsu:while x<4 應該是 x<5 吧? 11/22 23:23
推 fumizuki:While x <= 4 11/23 06:46