四则运算2程序及运行结果
package test2;
import java.util.*;
public class yunsuan2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a=0,b=0,c=0,d=0,e=0;
int h=-1;
int x=-1;
String S[]=new String[5000]; //string型数组,用来存储运算题,方便与前面进行比较,看是否有重复
Scanner in=new Scanner(System.in);
do
{
dingzhi D=new dingzhi();
fushu F=new fushu();
fu fu=new fu();
int m=0;
int z=0;
D.Input();
while(D.i*D.j>5000) //对需要输出题目的总数进行查看,是否符合数组的存储范围
{
System.out.print("输入的题目总数已超过最大出题数,请重新输入:");
D.Input();
}
F.Input1();
F.Input2();
fu.Input();
Random R=new Random();
if(fu.Q==0) //不进行负数运算
{
for(int i=0;i<(D.i*D.j);i++)
{
int k=0;
do
{
m=0;
c=R.nextInt(5);
for(int j=0;j<F.X;j++)
{
if(F.C[j]==c)
{
switch(c)
{
case 1: //加法
do
{
if(F.W==1) //有负数运算
{
int G=R.nextInt(2);
int g=R.nextInt(2);
switch(G) //随机产生一个数
{
case 0:a=(int) (D.n+Math.random()*(D.m-D.n+1));break;
case 1:a=-(int) (D.n+Math.random()*(D.m-D.n+1));break;
}
switch(g) //随机产生另一个数
{
case 0: b=-(int) (D.n+Math.random()*(D.m-D.n+1));break;
case 1: b=(int) (D.n+Math.random()*(D.m-D.n+1));break;
}
}
else //无负数运算
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+")+("+b+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 2: //减法
do
{
if(F.W==1) //有负数运算
{
int G=R.nextInt(2);
int g=R.nextInt(2);
switch(G) //随机产生一个数
{
case 0: a=-(int)(D.n+Math.random()*(D.m-D.n+1));break;
case 1: a=(int) (D.n+Math.random()*(D.m-D.n+1));break;
}
switch(g) //随机产生另一个数
{
case 0: b=-(int)(D.n+Math.random()*(D.m-D.n+1));break;
case 1: b=(int) (D.n+Math.random()*(D.m-D.n+1));break;
}
}
else //无负数运算
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+")"+"-"+"("+b+""+")=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 3: //除法
do
{
if(F.F==1) //有余数取值
{
do
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
do
{
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}while(b==0);
}while(a%b==0);
}
else //无余数取值
{
do
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
do
{
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}while(b==0);
}while(a%b!=0);
}
S[i]=a+""+"/"+b+""+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 4: //乘法
do
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
S[i]=a+""+"*"+b+""+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
}
}
else
{
m++;
}
}
}while(m==F.X);
}
}
else if(fu.Q==1) //有分数运算
{
System.out.print("请选则1-真分数,2-假分数,3-真分数和假分数:");
z=in.nextInt();
while((z!=1)&&(z!=2)&&(z!=3))
{
System.out.print("输入有误!请重新输入:");
z=in.nextInt();
}
if(z==1) //真分数运算
{
for(int i=0;i<(D.i*D.j);i++)
{
int k=0;
do
{
m=0;
c=R.nextInt(5);
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
for(int j=0;j<F.X;j++)
{
if(F.C[j]==c)
{
switch(c)
{
case 1:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e>=d)||(d==0)||(e==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")+("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 2:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e>=d)||(d==0)||(e==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")-("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 3:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e>=d)||(d==0)||(e==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")/("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 4:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e>=d)||(d==0)||(e==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")*("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
}
}
else
{
m++;
}
}
}while(m==F.X);
}
}
else if(z==2) //假分数运算
{
for(int i=0;i<D.i*D.j;i++)
{
int k=0;
do
{
m=0;
c=R.nextInt(5);
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
for(int j=0;j<F.X;j++)
{
if(F.C[j]==c)
{
switch(c)
{
case 1:
do
{
while((a<b)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")+("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 2:
do
{
while((a<b)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")-("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 3:
do
{
while((a<b)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")/("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 4:
do
{
while((a<b)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")*("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
}
}
else
{
m++;
}
}
}while(m==F.X);
}
}
else if(z==3) //真假分数运算
{
for(int i=0;i<D.i*D.j;i++)
{
int k=0;
do
{
m=0;
c=R.nextInt(5);
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
for(int j=0;j<F.X;j++)
{
if(F.C[j]==c)
{
switch(c)
{
case 1:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")+("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 2:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")-("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 3:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")/("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
case 4:
do
{
while((a>=b)||(a==0)||(b==0))
{
a=(int) (D.n+Math.random()*(D.m-D.n+1));
b=(int) (D.n+Math.random()*(D.m-D.n+1));
}
while((e<d)||(d==0))
{
e=(int) (D.n+Math.random()*(D.m-D.n+1));
d=(int) (D.n+Math.random()*(D.m-D.n+1));
}
S[i]="("+a+""+"/"+b+""+")*("+e+""+"/"+d+""+")"+"=";
for(int l=0;l<i;l++)
{
if(S[l]==S[i])
{
k=1;
break;
}
}
}while(k==1);
break;
}
}
else
{
m++;
}
}
}while(m==F.X);
}
}
}
System.out.print("请输入你要打印的格式(每页以几列输出):");
x=in.nextInt();
int v=0;
System.out.println("四则运算题:");
for(int i=0;i<D.j;i++)
{
int u=0;
for(int j=0;j<D.i;j++)
{
System.out.printf("%30s",S[v]);
v++;
u++;
if(u%x==0)
{
System.out.println();
}
}
System.out.println();
System.out.println("第"+(i+1)+"页");
}
System.out.print("是否还要继续打印(是——1,否——0):");
h=in.nextInt();
while((h!=0)&&(h!=1))
{
System.out.print("输入有误!请重新输入:");
h=in.nextInt();
}
}while(h==1);
}
}
class dingzhi //输入需要打印的每页题数与页数
{
public int i,j;
public int n,m;
Scanner S=new Scanner(System.in);
dingzhi()
{
i=0;
j=0;
n=0;
m=0;
}
public void Input()
{
System.out.print("请输入每页输出的题目数:");
i=S.nextInt();
System.out.print("请输入打印的页数:");
j=S.nextInt();
System.out.print("请输入算术题运算数的范围(例如:范围在0~100之间,输入0 100):");
n=S.nextInt();
m=S.nextInt();
}
}
class choice
{
public int X;
public int Y;
public int C[]=new int[4];
Scanner S=new Scanner(System.in);
choice()
{
X=0;Y=-1;
}
}
class fushu extends choice //对加减乘除法进行选择并且存放在数组里,并对负数运算以及除法是否取余进行选择
{
public int W,F;
fushu()
{
W=-1;
F=-1;
}
public void Input1()
{
do
{
System.out.print("请对加减乘除法进行选择(1-加法,2-减法,3-除法,4-乘法(请选择一项,不再选择请输入—0)):");
Y=S.nextInt();
while((Y!=0)&&(Y!=1)&&(Y!=2)&&(Y!=3)&&(Y!=4))
{
System.out.print("输入错误请重新输入:");
Y=S.nextInt();
}
if(Y!=0)
{
C[X]=Y;
X++;
}
else
{
break;
}
}while(Y!=0);
}
public void Input2()
{
for(int a=0;a<X;a++)
{
if((C[a]==1)||(C[a]==2))
{
while((W!=1)&&(W!=0))
{
System.out.print("是否要有负数运算(是——1,否——0):");
W=S.nextInt();
while((W!=1)&&(W!=0))
{
System.out.print("输入有误,请重新输入:");
W=S.nextInt();
}
}
}
if(C[a]==3)
{
System.out.print("除法运算的结果是否要有余数(是——1,否——0):");
F=S.nextInt();
while((F!=1)&&(F!=0))
{
System.out.print("输入有误,请重新输入:");
F=S.nextInt();
}
}
}
}
}
class fu //对分数运算进行选择
{
public int Q;
fu()
{
Q=-1;
}
Scanner S=new Scanner(System.in);
public void Input()
{
System.out.print("是否要有分数运算(是-1,无——0):");
Q=S.nextInt();
while((Q!=1)&&(Q!=0))
{
Q=S.nextInt();
}
}
}
运行结果:
请输入每页输出的题目数:40 请输入打印的页数:2 请输入算术题运算数的范围(例如:范围在0~100之间,输入0 100):0 100 请对加减乘除法进行选择(1-加法,2-减法,3-除法,4-乘法(请选择一项,不再选择请输入—0)):1 请对加减乘除法进行选择(1-加法,2-减法,3-除法,4-乘法(请选择一项,不再选择请输入—0)):3 请对加减乘除法进行选择(1-加法,2-减法,3-除法,4-乘法(请选择一项,不再选择请输入—0)):0 是否要有负数运算(是——1,否——0):1 除法运算的结果是否要有余数(是——1,否——0):1 是否要有分数运算(是-1,无——0):0 请输入你要打印的格式(每页以几列输出):4 四则运算题: 22/37= (-79)+(-28)= (77)+(13)= (33)+(54)= (72)+(-77)= 48/40= (0)+(69)= (-87)+(-46)= (1)+(-61)= (-50)+(-50)= 69/24= (99)+(-64)= 73/78= (-6)+(-46)= 97/57= (35)+(-34)= 81/62= (-26)+(-90)= (25)+(75)= 31/68= (24)+(61)= 35/61= 91/54= (-8)+(-72)= 77/49= (-74)+(-77)= (-34)+(96)= 66/32= 10/68= 78/87= (-57)+(-65)= (0)+(96)= 32/37= 99/46= 44/7= (-8)+(-35)= (-49)+(-76)= (-33)+(-89)= (32)+(-44)= 65/76= 第1页 (51)+(-6)= (85)+(-63)= 92/82= 93/10= (-91)+(42)= (48)+(-8)= (-34)+(-12)= (59)+(37)= 10/84= 6/77= 82/68= 66/98= 13/74= 51/63= (-29)+(97)= 9/75= (34)+(74)= 45/35= (-74)+(-88)= (-81)+(84)= 44/19= 3/82= (88)+(-7)= 15/70= 50/42= 97/67= (66)+(100)= 64/78= 23/80= (22)+(80)= 81/32= (-64)+(84)= 5/82= (-92)+(92)= 36/100= 73/83= (-36)+(20)= (-79)+(54)= (56)+(-31)= (-5)+(57)= 第2页 是否还要继续打印(是——1,否——0):1 请输入每页输出的题目数:50 请输入打印的页数:4 请输入算术题运算数的范围(例如:范围在0~100之间,输入0 100):10 200 请对加减乘除法进行选择(1-加法,2-减法,3-除法,4-乘法(请选择一项,不再选择请输入—0)):4 请对加减乘除法进行选择(1-加法,2-减法,3-除法,4-乘法(请选择一项,不再选择请输入—0)):0 是否要有分数运算(是-1,无——0):1 请选则1-真分数,2-假分数,3-真分数和假分数:3 请输入你要打印的格式(每页以几列输出):2 四则运算题: (61/165)*(196/12)= (60/82)*(195/30)= (56/145)*(126/119)= (96/189)*(191/19)= (61/150)*(107/90)= (46/122)*(107/74)= (54/132)*(174/136)= (87/112)*(149/116)= (66/107)*(149/148)= (16/144)*(102/53)= (117/132)*(175/81)= (29/152)*(147/19)= (23/110)*(170/100)= (67/183)*(72/63)= (50/102)*(138/133)= (130/185)*(68/54)= (64/139)*(189/133)= (125/193)*(200/52)= (25/46)*(162/82)= (38/101)*(200/129)= (139/183)*(65/29)= (66/168)*(166/116)= (99/189)*(184/119)= (113/175)*(37/18)= (62/105)*(148/18)= (94/164)*(144/26)= (129/185)*(108/42)= (13/195)*(118/77)= (20/180)*(65/27)= (48/171)*(188/114)= (57/192)*(98/94)= (22/80)*(128/75)= (101/194)*(133/62)= (13/97)*(167/53)= (31/40)*(74/10)= (70/193)*(128/32)= (67/199)*(147/115)= (114/177)*(179/52)= (31/98)*(196/157)= (11/32)*(165/158)= (74/190)*(174/65)= (28/198)*(178/147)= (55/95)*(49/31)= (104/142)*(66/10)= (46/57)*(148/102)= (25/67)*(136/109)= (44/145)*(121/48)= (73/74)*(199/70)= (11/39)*(65/32)= (10/73)*(173/154)= 第1页 (132/157)*(193/111)= (142/179)*(132/80)= (177/193)*(199/112)= (90/169)*(190/52)= (79/185)*(132/64)= (68/167)*(183/102)= (144/187)*(142/138)= (77/105)*(152/71)= (95/160)*(145/26)= (23/124)*(167/70)= (38/41)*(105/99)= (15/84)*(178/39)= (33/69)*(138/97)= (121/160)*(192/106)= (22/125)*(96/66)= (15/84)*(69/60)= (11/115)*(57/21)= (101/118)*(148/63)= (61/73)*(169/156)= (113/164)*(187/29)= (38/197)*(96/10)= (170/190)*(172/20)= (67/171)*(68/68)= (66/97)*(151/139)= (68/189)*(172/58)= (31/45)*(174/100)= (85/169)*(117/110)= (149/177)*(192/135)= (111/156)*(117/85)= (117/169)*(153/131)= (125/197)*(197/107)= (137/199)*(90/82)= (13/54)*(155/16)= (90/123)*(110/28)= (67/169)*(108/79)= (144/195)*(186/172)= (38/170)*(107/76)= (97/187)*(66/42)= (93/131)*(184/26)= (14/66)*(150/95)= (99/123)*(95/57)= (63/78)*(120/55)= (140/143)*(171/110)= (36/147)*(165/22)= (133/164)*(172/89)= (88/140)*(174/168)= (67/113)*(144/69)= (23/149)*(183/20)= (17/89)*(198/31)= (67/155)*(150/114)= 第2页 (77/142)*(154/148)= (96/189)*(194/179)= (50/141)*(91/62)= (10/128)*(162/101)= (92/199)*(114/83)= (125/193)*(44/23)= (157/161)*(157/74)= (15/146)*(143/10)= (55/115)*(170/54)= (20/156)*(176/172)= (58/88)*(59/19)= (102/161)*(82/14)= (83/178)*(184/74)= (35/45)*(105/40)= (144/179)*(154/87)= (173/195)*(198/20)= (49/126)*(147/120)= (41/150)*(198/166)= (28/99)*(189/180)= (35/185)*(144/110)= (16/87)*(130/51)= (60/73)*(135/76)= (41/107)*(155/39)= (170/184)*(192/156)= (88/146)*(154/116)= (58/111)*(69/31)= (94/129)*(73/52)= (88/168)*(128/11)= (41/137)*(195/34)= (12/50)*(181/53)= (43/154)*(102/63)= (14/37)*(82/36)= (45/188)*(100/21)= (93/102)*(37/17)= (110/144)*(123/59)= (102/135)*(151/114)= (71/83)*(175/42)= (84/198)*(54/17)= (27/188)*(90/38)= (125/149)*(141/121)= (152/166)*(176/12)= (12/193)*(185/14)= (74/149)*(57/10)= (11/90)*(189/119)= (23/72)*(185/31)= (37/173)*(84/55)= (37/151)*(135/88)= (166/186)*(199/80)= (22/80)*(185/110)= (168/181)*(142/98)= 第3页 (43/143)*(191/159)= (115/193)*(40/18)= (70/165)*(135/126)= (149/166)*(186/151)= (55/122)*(146/134)= (11/17)*(58/23)= (70/157)*(129/28)= (63/110)*(152/63)= (50/165)*(152/61)= (79/198)*(145/135)= (90/125)*(166/73)= (94/156)*(190/136)= (75/154)*(132/131)= (44/100)*(119/103)= (27/153)*(155/59)= (68/114)*(88/35)= (70/144)*(164/162)= (92/200)*(177/141)= (72/147)*(151/80)= (91/99)*(118/74)= (53/106)*(71/10)= (40/51)*(189/30)= (88/186)*(189/74)= (41/59)*(166/158)= (104/113)*(87/58)= (10/118)*(131/53)= (70/105)*(52/11)= (185/191)*(133/87)= (66/188)*(137/117)= (67/110)*(74/72)= (55/92)*(150/38)= (12/25)*(108/105)= (62/67)*(174/23)= (29/174)*(90/77)= (86/147)*(191/44)= (48/87)*(90/89)= (33/159)*(172/167)= (93/107)*(141/122)= (105/148)*(161/53)= (176/186)*(133/131)= (62/67)*(101/22)= (43/133)*(175/101)= (48/179)*(61/22)= (36/83)*(200/181)= (71/107)*(115/98)= (72/149)*(118/83)= (103/107)*(167/28)= (163/184)*(154/24)= (86/101)*(196/36)= (14/137)*(122/122)= 第4页 是否还要继续打印(是——1,否——0):0
编程总结:
此次编程,在程序运行时遇到了很多问题。主要有:(1)在运行时算式不能按原意输出,经检查是随机函数使用错误(刚开始没注意到,浪费了很多时间);(2)运算题输出时,有“null”输出,检查后发现是用来判断执行do...while的条件变量位置放置不对;(3)输出格式问题,刚开始用System.out.print()输出,后改为System.out.printf()输出。
时间记录日志: