[java]代码库
package java111;
public class Shuangseqiu {
public static void main(String[] args) {
// TODO Auto-generated method stub
Shuangseqiu s=new Shuangseqiu();
int num1= (int) Math.floor(Math.random()*33+1);
int num2= (int) Math.floor(Math.random()*33+1);
while (num2==num1) {
num2= (int) Math.floor(Math.random()*33+1);
}
int num3= (int) Math.floor(Math.random()*33+1);
while (num3==num1||num3==num2) {
num3= (int) Math.floor(Math.random()*33+1);
}
int num4= (int) Math.floor(Math.random()*33+1);
while (num4==num1||num4==num2||num4==num3) {
num4= (int) Math.floor(Math.random()*33+1);
}
int num5= (int) Math.floor(Math.random()*33+1);
while (num5==num1||num5==num2||num5==num3||num5==num4) {
num5= (int) Math.floor(Math.random()*33+1);
}
int num6= (int) Math.floor(Math.random()*33+1);
while (num6==num1||num6==num2||num6==num3||num6==num4||num6==num5) {
num6= (int) Math.floor(Math.random()*33+1);
}
int[] num=new int[]{num1,num2,num3,num4,num5,num6};
int b;
for (int i = 0; i <num.length; i++) {
for (int j =i+1; j <num.length; j++) {
if (num[i]>num[j]) {
b=num[i];
num[i]=num[j];
num[j]=b;
}
}
}
num1=num[0];
num2=num[1];
num3=num[2];
num4=num[3];
num5=num[4];
num6=num[5];
System.out.println("第一个号码是 "+num1);
System.out.println("第二个号码是 "+num2);
System.out.println("第三个号码是 "+num3);
System.out.println("第四个号码是 "+num4);
System.out.println("第五个号码是 "+num5);
System.out.println("第六个号码是 "+num6);
int num7= (int) Math.floor(Math.random()*16+1);
System.out.println("篮球号码是 "+num7);
初级程序员
by: andyhu2017 发表于:2017-09-01 14:43:56 顶(0) | 踩(0) 回复
代码不全。
回复评论