标签:
设计思想:
随机生成数,两个用来当做运算符两边的数字,一个用来判断运算符,循环30次输出
import java.lang.Math;
public class erzhuzi {
public static void main(String[] args){
for(int i=0;i<30;i++)
{
int firstone = (int) (Math.random()*100);
int secondone = (int) (Math.random()*100);
int yunsuanfu = (int) (1+Math.random()*4);
if (yunsuanfu==1)System.out.println(firstone+"+"+secondone+"=");
if (yunsuanfu==2)System.out.println(firstone+"-"+secondone+"=");
if (yunsuanfu==3)System.out.println(firstone+"*"+secondone+"=");
if (yunsuanfu==4&&secondone!=0)System.out.println(firstone+"/"+secondone+"=");
}
}
}
上课未完成原因:太笨了
标签:
原文地址:http://www.cnblogs.com/nxxam/p/5263180.html