首页 > 其他 > 详细

软件工程个人作业01

时间:2016-03-10 20:20:37      阅读:183      评论:0      收藏:0      [点我收藏+]

设计思想:

随机生成数,两个用来当做运算符两边的数字,一个用来判断运算符,循环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+"=");
    }
  }

}

技术分享

上课未完成原因:太笨了

 

软件工程个人作业01

原文:http://www.cnblogs.com/nxxam/p/5263180.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!