9.11

 

 

1.面对程序,我们要复杂问题简单化,简单问题流程化;

2.具体分为四个步骤:分解、模、抽象和算法;

3.给我们讲了一些基础的语法,变量间的类型转换,数据类型转换方法,两种类型的变量

 

 

课堂测试:

复制代码
 1 package ceshi;
 2 import java.util.Random;
 3 
 4 import java.util.Scanner;
 5 
 6 
 7 public class sizeyunxuan {
 8 
 9     public static void operate() {
10         String[]operate=new String[]{"+","-","*","/"};
11         Random r=new Random();
12         System.out.print(operate[r.nextInt(4)]);
13     }
14     public static void main(String[] args) {
15 
16         int []a=new int[100];
17         int []b=new int[100];
18 
19 
20         Scanner scan =new Scanner(System.in);
21         int n;
22         System.out.println("请输入需要的题目数:");
23         n=scan.nextInt();
24 
25 
26 
27         int i,j;
28         for(i=0;i<n;i++)
29         {
30 
31             Random r=new Random();
32             a[i]=r.nextInt(99);
33             b[i]=r.nextInt(9);
34 
35             for(j=0;j<i;j++) {
36                 if(a[i]==b[j]&&b[i]==a[j]) {
37                     a[i]=r.nextInt(99)-1;
38                 }
39             }
40             int t=(int)r.nextInt(4);
41             switch(t)
42             {
43                 case 0:
44                     System.out.println(a[i]+" + "+b[i]+"=");
45                     break;
46                 case 1:
47                     System.out.println(a[i]+" - "+b[i]+"=");
48                     break;
49                 case 2:
50                     System.out.println(a[i]+" * "+b[i]+"=");
51                     break;
52                 case 3:
53                     System.out.println(a[i]+" / "+b[i]+"=");
54                     break;
55             }
56 
57 
58 
59 
60         }
61 
62     }
63 
64 }
 
 
posted @ 2023-09-11 23:33  KuanDong24  阅读(15)  评论(0编辑  收藏  举报