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();
}
}
}
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234745889-1514679754.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234750061-1166399184.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234756473-1363741017.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234800530-161446506.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234810058-1436363962.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234815213-2086754580.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234819022-1720025914.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234823233-2109064174.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234827089-165050753.jpg)
![](https://img2018.cnblogs.com/blog/1837681/201910/1837681-20191019234830329-965455447.jpg)
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();
}
}
}