package lianxi1; import java.util.*; public class Operation1 { static int i = 0; static int j = 0; static boolean trag = true; static public int getNumbera() { int a = (int)(1+Math.random()*100); return a; } static public int getNumberb() { int b = (int)(1+Math.random()*100); return b; } static public int getNumberc() { int c = (int)(1+Math.random()*4); return c; }
public static void main(String[] args) { // TODO Auto-generated method stub
Scanner sc = new Scanner(System.in); System.out.println("请输入需要的题目数量:"); int n = sc.nextInt(); System.out.println("请输入一行的题目数量:"); int line = sc.nextInt(); int x[] = new int[100000]; int y[] = new int[100000]; int z[] = new int[100000]; int temp; for(int i=0;i<n;i++) { for(int j=0;j<line;j++,i++) { char f = ‘0‘; x[i] = getNumbera(); y[i] = getNumberb(); z[i] = getNumberc();
int k = 0; while(x[k]==x[i]&&y[k]==y[i]&&z[k]==z[i]&&k<=i) { x[i] = getNumbera(); y[i] = getNumberb(); z[i] = getNumberc(); k++; }
switch(z[i]) { case 1: f = ‘+‘; break; case 2: f = ‘-‘; if(x[i]<y[i]) { temp = x[i]; x[i] = y[i]; y[i] = temp; } break; case 3: f = ‘*‘; if(x[i]*y[i]>100) { x[i]=x[i]/10; if(x[i]*y[i]>100) { y[i] = y[i]/10; } } break; case 4: f = ‘/‘;