每天一练:JavaScript 编程题&MySQL 编程题&Java 编程题20

  JAVA编程

输入3个数a,b,c,按大小顺序输出     

     程序分析利用指针方法。     

   public class Ex34 {  

      public static void main(String[] args)   

      {   

      int []arrays = {800,56,500};   

      for(int i=arrays.length;--i>=0;)   

      {   

      for(int j=0;j<i;j++)   

      {   

      if(arrays[j]>arrays[j+1])   

      {   

      int temp=arrays[j];   

      arrays[j]=arrays[j+1];   

      arrays[j+1]=temp;   

      }   

      }   

      }   

      for(int n=0;n<arrays.length;n++)   

      System.out.println(arrays[n]);   

    }  

 

2 javascript编程

实现在标题栏上动态显示当前时间的效果

 <html>

      <head>

          <title>新建网页 1</title>

      </head>

      <body onload="showTime()">

          <script>

              function showTime(){

              now=new Date();

              display=now.toLocaleString();

             document.title=display;

             setTimeout("showTime()",1000)

             }

         </script>

     </body>

 </html>

 

3 MySQL语句查询

查询计算机成绩低于95的学生信息

SELECT * FROM student

WHERE id IN

(SELECT stu_id FROM score

WHERE c_name="计算机" and grade<95);

+-----+--------+------+-------+------------+--------------+

| id  | name   | sex  | birth | department | address      |

+-----+--------+------+-------+------------+--------------+

| 902 | 张老二 |    | 1986  | 中文系     | 北京市昌平区 |

| 904 | 李四   |    | 1990  | 英语系     | 辽宁省阜新市 |

| 906 | 王六   |    | 1988  | 计算机系   | 湖南省衡阳市 |

+-----+--------+------+-------+------------+--------------+

猜你喜欢

转载自blog.csdn.net/zxfly6/article/details/80563825