首页 > 其他 > 详细

四则运算

时间:2017-12-02 20:11:17      阅读:197      评论:0      收藏:0      [点我收藏+]

1.源代码

package 四则运算;
//信1605-1张迪20163480
public class math {
     private int a,b,c,d;
     String f;
    
     public void set()
     {
         a=(int)(Math.random() * 99 + 1);
         b=(int)(Math.random() * 99 + 1);
         c=(int)(Math.random() * 3 + 1);
         
     } 
     public void result() {
         if(c==1)
         {
            
             System.out.println(a+"+"+b+"=");
         }
         else if(c==2)
         {
             System.out.println(a+"-"+b+"=");
         }
         else if(c==3)
         {
             System.out.println(a+"*"+b+"=");
         }
         else
         {
             System.out.println(a+"/"+b+"=");
         }
     }
   
     public static void main(String[] args) {
        math A=new math();
        for(int i=1;i<=60;i++)
        {
            A.set();
            A.result();
        }
        
     }
}

2.截图

技术分享图片

 

四则运算

原文:http://www.cnblogs.com/sunshine-z/p/7955332.html

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