四则运算

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.截图

 

posted @ 2017-12-02 19:47  路上的小小滴  阅读(97)  评论(0编辑  收藏  举报