作者shadow10 (天我被捲毛淹沒了)
看板NTUBA95study
標題剛剛安霆要我寫的樂透猜碼程式~~
時間Wed Jan 15 00:19:20 2003
隨機從1-64裡取出6個數字 不重複
唉再次體驗到寫程式的最大麻煩~~不是想法 是除錯
除了整整4個小時 有興趣可以看看喔 ~~~
<script>
var m=1
var tests=new Array()
tests[0]=0
for(i=0;i<6;i++)
{
for(k=1;m!=-1;k++)
{
x=Math.random() /*隨機取0 ~1之間的數 */
x=x*64
x=x+1
y=parseInt(x)
tests[i+1]=y
for(j=0;j<i+1;j++)
{
if(tests[i+1]==tests[j])
{
x=Math.random()
x=x*64
x=x+1
y=parseInt(x)
tests[i+1]=y
j=0
}
if(j==i)
{
m=-1
}
}
}
m=1
tests[i+1]=y
}
document.write("<br>")
document.write(tests[1])
document.write("-")
document.write(tests[2])
document.write("-")
document.write(tests[3])
document.write("-")
document.write(tests[4])
document.write("-")
document.write(tests[5])
document.write("-")
document.write(tests[6])
</script>
--
我喜歡做我想做的事
但是如果我沒有機會
我會試著去喜歡上我現在在做的事
~~~~我的哲學 ==> 生活以享受為最高目的
--
※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw)
◆ From: 61.59.239.215
→ shoestring:計概神 神計概 神乎其技計概神 跪下來拜 推140.112.169.211 01/15
→ kmykmy:控制碼? 推140.112.250.233 01/15
→ shadow10:何出此言....笑^^" 推 61.59.239.215 01/15
→ kmykmy:剛剛安霆要我寫的樂透猜碼程式... 推140.112.250.233 01/15
→ shadow10:ㄜ 其實是我把你跟承翰的ID搞錯了~~ 推 61.59.239.215 01/15
→ cin1229:承翰是誰:p 推 218.160.7.79 01/15
→ oishii:哈 這樣你們下學期修程設一定會樂在其中 推 202.178.164.58 01/15