模拟试题

3773考试网计算机等级考试模拟试题正文

2011计算机二级JAVA编程:35选7彩票程序

来源:fjzsksw.com 2010-11-4 14:12:08

 

 

  35选7彩票程序

  public class caipiao

  {

  static void generate()

  {

  int a[]=new int[7];

  int i,m,j;

  fan:for(j=0;j <7;j++){//外循环实现随机生成每组7个数

  a[j]=(int)(Math.random()*35+1);

  m=a[j];

  if(j>=1){

  for(i=0;i

  if(a[i]==m){

  j--;

  continue fan;

  }

  }

  if(a[j] <10)

  System.out.print("0"+a[j]+" ");

  else

  System.out.print(a[j]+" ");

  }

  }

  public static void main (String args[]){

  int n=Integer.parseInt(args[0]);

  System.out.println("中国福利彩票35选7");

  for(int i=0;i

  generate();

  System.out.println();

  }

  }

  }

 

 

触屏版 电脑版
3773考试网 琼ICP备12003406号-1