用java编写彩票程序
外卖店(){
numbers = new int[6];
}
作废外卖(){
int count = 6;
while(count & gt;0) {
int rand =(int)(math . random()* 48+1);
开关(计数){
案例6:
数字[0]= rand;
count-;
打破;
案例5:
if(numbers[0] == rand) {
继续;
}
numbers[1] =兰特;
count-;
打破;
案例4:
if(numbers[0]= = rand | | numbers[1]= = rand){
继续;
}
数字[2] =兰特;
count-;
打破;
案例三:
if(numbers[0]= = rand | | numbers[1]= = rand | | numbers[2]= = rand){
继续;
}
数字[3] =兰特;
count-;
打破;
案例二:
if(numbers[0]= = rand | | numbers[1]= = rand | | numbers[2]= = rand | | numbers[3]= = rand){
继续;
}
数字[4] =兰特;
count-;
打破;
案例1:
if(numbers[0]= = rand | | numbers[1]= = rand | | numbers[2]= = rand
| | numbers[3]= = rand | | numbers[4]= = rand){
继续;
}
数字[5] =兰特;
count-;
打破;
}
}
}
void显示(){
for(int I = 0;我& lt数字.长度;i++) {
system . out . print(numbers[I]+" ");
}
}
int[]数字;
}
公共类TakeOutAwardTest {
公共静态void main(String[] args) {
武胜=新武胜();
for(int I = 0;我& lt5;i++) {
system . out . print(" the "+(I+1)+"抽奖结果:");
wusheng . take out();
wusheng . display();
system . out . println();
}
}
}