The second week of school classroom tests cum simple Java code that the topic of school the second week of classroom tests cum simple Java code is out of question

The second week of school classroom tests cum simple Java code is out of question

 

Code can have the functions of double-digit arithmetic, while ensuring the result of the multiplication does not exceed 100, an integer result of the division, the result of the subtraction is positive.

In addition, the user can also set a number of questions, and the number of rows in each subject.

Source code for: 2901583663

package first;

java.util.Scanner Import;
Import java.util.Random;
public class One {
static Scanner Scanner new new SC = (the System.in);
  public static void main (String [] args) {
  int num1,
  num2,
  num3;
  int B ;
  int AAA [] [] = new new int [100000] [. 3];
  char C = '';
  int num_end;
  int length;
  Boolean = Jud to false;
  System.out.println ( "Please choose how many questions production:") ;
  num_end sc.nextInt = ();
  System.out.println ( "Please enter each line of output few questions:");
  length = sc.nextInt ();
  for (int I = 0; I <num_end;) {
    the Random the Random = new new A ();
    num1 = a.nextInt (101);
    num2 = a.nextInt (101);
    num3 = a.nextInt (101);
    B = num3. 4%;
    switch(b){
    case 0:
      c='+';
      break;
    case 1:
      c='-';
      break;
    case 2:
      c='*';
      break;
    case 3:
      c='/';
      break;
    }
  if(b==3&&num2==0){
    continue;
  }
  if(b==2&&(num1*num2)>100){
    continue;
  }
  if(b==3&&(num1%num2)!=0){
    continue;
  }
  if(b==1&&((num1-num2)<0)) {
    continue;
  }
  else{
    jud=true;
  }
  for(int u=0;u<i;u++){
    int a1=0,a2=0,a3=0;
    a1=aaa[i][0];
    a2=aaa[i][1];
    a3=aaa[i][2];
    if(a1==num1&&a2==num2&&a3==b){
      jud=false;
    }
  }
  if(jud){
    int end=i+1;
    System.out.print("这是第" + end + "道题: " +num1 + c + num2 + "= ");
    i++;
  }
  if(i<100000){
  aaa[i][0]=num1;
  aaa[i][1]=num2;
  aaa[i][2]=b;
  }
  if(i%length==0)
  System.out.println();
    }
  }
}

Code can have the functions of double-digit arithmetic, while ensuring the result of the multiplication does not exceed 100, an integer result of the division, the result of the subtraction is positive.

In addition, the user can also set a number of questions, and the number of rows in each subject.

Source code for: 2901583663

package first;

java.util.Scanner Import;
Import java.util.Random;
public class One {
static Scanner Scanner new new SC = (the System.in);
  public static void main (String [] args) {
  int num1,
  num2,
  num3;
  int B ;
  int AAA [] [] = new new int [100000] [. 3];
  char C = '';
  int num_end;
  int length;
  Boolean = Jud to false;
  System.out.println ( "Please choose how many questions production:") ;
  num_end sc.nextInt = ();
  System.out.println ( "Please enter each line of output few questions:");
  length = sc.nextInt ();
  for (int I = 0; I <num_end;) {
    the Random the Random = new new A ();
    num1 = a.nextInt (101);
    num2 = a.nextInt (101);
    num3 = a.nextInt (101);
    B = num3. 4%;
    switch(b){
    case 0:
      c='+';
      break;
    case 1:
      c='-';
      break;
    case 2:
      c='*';
      break;
    case 3:
      c='/';
      break;
    }
  if(b==3&&num2==0){
    continue;
  }
  if(b==2&&(num1*num2)>100){
    continue;
  }
  if(b==3&&(num1%num2)!=0){
    continue;
  }
  if(b==1&&((num1-num2)<0)) {
    continue;
  }
  else{
    jud=true;
  }
  for(int u=0;u<i;u++){
    int a1=0,a2=0,a3=0;
    a1=aaa[i][0];
    a2=aaa[i][1];
    a3=aaa[i][2];
    if(a1==num1&&a2==num2&&a3==b){
      jud=false;
    }
  }
  if(jud){
    int end=i+1;
    System.out.print("这是第" + end + "道题: " +num1 + c + num2 + "= ");
    i++;
  }
  if(i<100000){
  aaa[i][0]=num1;
  aaa[i][1]=num2;
  aaa[i][2]=b;
  }
  if(i%length==0)
  System.out.println();
    }
  }
}

Guess you like

Origin www.cnblogs.com/tertr99/p/11706390.html