English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

各位vb高手~請問以下的程式中~如何少掉一半的行數~但執行的結果也是一樣的~~謝謝 昰合併FOR 迴圈ㄇ??
<%
N=request("sex")
if N = "女生" then
response.write "

"
for i=1 to 9
response.write " "
for j=1 to 9
response.write ""
next
response.write " "
next
response.write "
" & i & "x" & j & "=" & i*j & "
"
elseif
if N = "男生" then
response.write ""
for i=1 to 9
response.write " "
for j=1 to 9
response.write ""
next
response.write " "
next
response.write "
" & i & "x" & j & "=" & i*j & "
"
end if
%>

2007-01-14 15:09:02 · 2 個解答 · 發問者 11 1 in 電腦與網際網路 程式設計

感謝兩位的大力幫忙!!~謝謝

2007-01-15 17:11:30 · update #1

2 個解答

<%
N=request("sex")
if N = "女生" then
sColor="red"
elseif N="男生" then
sColor="blue"
end if
response.write "

"
for i=1 to 9
response.write " "
for j=1 to 9
response.write ""
next
response.write " "
next
response.write "
" & i & "x" & j & "=" & i*j & "
"
%>
如果是我的話會多加一個顏色變數,這樣的話只有一個
,比較不會搞混!

2007-01-15 10:50:50 · answer #1 · answered by ? 5 · 0 0

<%
N=request("sex")
if N = "女生" then
response.write "

"
else
response.write "
"
endif

for i=1 to 9
response.write " "
for j=1 to 9
response.write ""
next
response.write " "
next
response.write "
" & i & "x" & j & "=" & i*j & "
"
%>
我是用 VB6.0
可是 你的 next 難道不必寫成 next j 和 next i 嗎?
如果有問題, 請來函討論. 不然, 我可能會錯失你再補充的疑點.

2007-01-15 04:49:47 · answer #2 · answered by JJ 7 · 0 0

fedest.com, questions and answers