}
public static void contrast(String[] sys,String[] person){//判断中了几等奖
int number = 0;
for (int i = 0; i < sys.length-1; i++) {
for (int j = 0; j < person.length-1; j++) {
if(person[j].equals(sys[i])){
number++;
}
}
}
if(sys[sys.length-1].equals(person[person.length-1])){
String num = "";
switch(number){
case 6:
num = "一";
break;
case 5:
num = "二";
break;
case 4:
case 3:
num = "三";
break;
case 2:
case 1:
num = "四";
break;
default:
break;
}
System.out.println("恭喜你获得"+num+"等奖");
}else
System.out.println("对不起您没有中奖");
}
public static void print() { //遍历可选球号
System.out.println("红球区选择6个球,每个号码在同一注中只能选一次");
for (int i = 1; i <= 33; i++) {
System.out.print(" "+numIf(i));
if (i % 11 == 0) {
System.out.println();
}
}
System.out.println("蓝球区可选择一个号码");
for (int i = 1; i <= 16; i++) {
System.out.print(" "+numIf(i));
if(i%8==0){
System.out.println();
}
}
}
public static void redBall() {// 系统开出号码获取
Random r = new Random();
String s = "";
for (int i = 0; i < sysNumber.length - 1; i++) {
int n = r.nextInt(33) + 1;
if (judeg(sysNumber,n)) {
s = numIf(n);
sysNumber[i] = s;
} else
i--;
}
int n = r.nextInt(16) + 1;
s = numIf( n);
sysNumber[sysNumber.length-1] = s;
}
public static String numIf(int n) {//把9以的数字前面加上0,并把所胡数字转成字符串
String s;
if (n < 10) {
s = "0" + n;
} else {
s = "".valueOf(n);
}
return s;
}
public static boolean judeg(String[] sys,int n) {// 判断int随机娄是否重复
for (int i = 0; i < sys.length; i++) {
if (!"".equals(sys[i])) {
if (Integer.valueOf(sysNumber[i]) == n) {
return false;
}
}
}
return true;
}
public static void print(String[] s) {
for (int i = 0; i < s.length; i++) {
System.out.print(s[i] + " ");
}
System.out.println();
}
} 作者: Zzh94520 时间: 2016-10-8 21:39
........................作者: 小明教授 时间: 2016-10-8 22:02
好长,好长作者: IceLoveInFire丶 时间: 2016-10-8 22:48
前面的几个跟匹配的顺序有关系吗?作者: 企鹅1号 时间: 2016-10-9 01:21
顺序就先不管了,排序这个事,比较简单,先考虑一些规则的东西,