一.初始版本
1 Random r = new Random(); 2 String []fuhao= {"*","+","-","/"}; 3 for(int a=1;a<31;a++) 4 { 5 int num1=r.nextInt(1000)+1; 6 System.out.print(num1); 7 int num=r.nextInt(4); 8 System.out.print(fuhao[num]); 9 int num2=r.nextInt(1000)+1; 10 System.out.print(num2); 11 System.out.print("= "); 12 if(a%5==0) 13 System.out.println(); 14 }
显示如下:
最初的版本只有简单的加减乘除运算,且只是两个数字的运算