Math quizzes

First idea: to try the rand to generate random number seed to generate random numbers, and then define the data arrays are ten to re-check and storage

package Ktang;
import java.util.Random;
import java.util.Scanner;
public class Student {
static final int x = 100000;
public static void main(String[] args) {
// TODO Auto-generated method stub
Random r = new Random(1);
int i=0;
int j=0;
Scanner sc=new Scanner(System.in);
int a;
int b;
int c=0;
int date1[]=new int[x];
int date2[]=new int[x];
int jia1[]=new int[x];
int jia2[]=new int[x];
int jian1[]=new int[x];
int jian2[]=new int[x];
int cheng1[]=new int[x];
int cheng2[]=new int[x];
int chu1[]=new int[x];
int chu2[]=new int[x];
System.out.println ( "Please enter the title number and line number of how much you want");
A = sc.nextInt ();
b = sc.nextInt ();
for (i = 0; i <A; i ++ )
{
int = r.nextInt RAN1 (100);
int = RAN2 r.nextInt (100);
date1 [I] = RAN1;
DATE2 [I] = RAN2;
jia1 [I] = RAN1;
jia2 [I] = RAN2;
jian1 [I] = RAN1;
jian2 [I] = RAN2;
cheng1 [I] = RAN1;
cheng2 [I] = RAN2;
CHu1 [I] = RAN1;
chu2 [I] = RAN2;
}
the while (C <= A)
{
C ++;
for (I =. 1; I <= B; I ++)
{
int r.nextInt RAN2 = (. 3);

System.out.println("第"+i+"个");
switch(ran2)
{
case 0 :for(j=a;j>=0;j--)
{if(jia1[j]!=date1[i]&&jia2[j]!=date2[i])
{System.out.println(date1[i]+"+"+date2[i]+"=");}}
break;

case 1 :for(j=a;j>=0;j--)
{if(jian1[j]!=date1[i]&&jian2[j]!=date2[i])
{if(date1[i]>=date2[i])
{
System.out.println(date1[i]+"-"+date2[i]+"=");
break;}
else
{System.out.println(date1[i]+"-"+date2[i]+"=");
break;
}}}
case 2 :for(j=a;j>=0;j--)
{if(cheng1[j]!=date1[i]&&cheng2[j]!=date2[i])
System.out.println(date1[i]+"*"+date2[i]+"=");
break;}
case 3 :
for(j=a;j>=0;j--)
{if(chu1[j]!=date1[i]&&chu2[j]!=date2[i])
      System.out.println(date1[i]+"/"+date2[i]+"=");
break;
}
}
}
}
}
}

Guess you like

Origin www.cnblogs.com/sunhongbin/p/11539863.html