题目:
我的
代码:
1 package school_question; 2 3 import java.util.LinkedList; 4 import java.util.Scanner; 5 import java.util.Stack; 6 7 public class sizeyunsuan { 8 9 public static void main(String[] args) { 10 System.out.println("需要括号:"); 11 System.out.println("1.是的 2.不用"); 12 biaodashi(); 13 14 jieguo(); 15 16 } 17 public static void biaodashi(){ 18 Stackstack=new Stack (); 19 int a,b,c,d; 20 a=(int)Math.random()*100; 21 b=(int)Math.random()*100; 22 c=(int)Math.random()*100; 23 d=(int)Math.random()*100; 24 String s1=String.valueOf(a); 25 String s2=String.valueOf(b); 26 String s3=String.valueOf(c); 27 String s4=String.valueOf(d); 28 stack.push(s1); 29 stack.push(s2); 30 stack.push(s3); 31 stack.push(s4); 32 } 33 public static void youxianji(){ 34 35 } 36 public static void jieguo(){ 37 int i,a,b,c,d; 38 int mode,isint = 0; 39 int max; //确定数值的最大值 40 double result; 41 mode=0; 42 Scanner in=new Scanner(System.in); 43 int flag_fenshu,flag_fushu,flag_yushu; 44 System.out.println("数值能接受的最大值:"); 45 max=in.nextInt(); 46 System.out.println("需要分数吗?"); 47 System.out.println("1.是的 2.不用"); 48 flag_fenshu=in.nextInt(); 49 System.out.println("需要负数吗:"); 50 System.out.println("1.是的 2.不用"); 51 flag_fushu=in.nextInt(); 52 System.out.println("体量:"); 53 int n=in.nextInt(); 54 for(i=0;i
截图: