A. 易語言抽獎源碼
用取隨機數就行了嘛!使用時鍾一直刷,然後點擊停止就OK了!得到什麼數就是什麼數了!如果你想要它自動停止,也可以使用時鍾!
B. 使用java語言編寫一個抽獎系統
packagech07;
importjavax.swing.*;
publicclassTest2{
publicstaticvoidmain(String[]args){
Stringoutput="";
output+="恭喜第"+(1+(int)(Math.random()*100))+"號中了一等獎";
output+="
恭喜第"+(1+(int)(Math.random()*100))+"號"+(int)(1+(Math.random()*100))+"號"+"中了二等獎";
for(inti=0;i<3;i++){
output+="
恭喜第"+(1+(int)(Math.random()*100))+"號中了三等獎";
}
JOptionPane.showMessageDialog(null,output);
}
}
程序運行結果截圖
中獎的人是隨機的!