zoukankan      html  css  js  c++  java
  • 国庆作业

    import java.util.Scanner;
    public class L

    {

        public static void main(String[] args)

    {
            System.out.println("5+5="+5+5);
           
            int a=3,b;
            b=a++;
            System.out.println("a="+a+",b="+b);
           
            short c=3;
            c=(short) (c+4);
            System.out.println("c="+c);
           
            short d=3;
            d+=4;
            System.out.println("d="+d);
           
            System.out.println(6&3);
            System.out.println(6|3);
            System.out.println(6^3);
            System.out.println(3<<2);
            System.out.println(3>>1);
           
            int e=0,f;
            f=e>1?100:200;
            System.out.println("f="+f);
           
            @SuppressWarnings("resource")
            Scanner input=new Scanner(System.in);
            int g,h;
            System.out.println("Enter the g ");
            g=input.nextInt();
            System.out.println("Enter the h ");
            h=input.nextInt();
            h=g>h?g:h;
            System.out.println("The larger of the two numbers is"+h);
           
            @SuppressWarnings("resource")
            Scanner input1=new Scanner(System.in);
            int x,y,z;
            System.out.println("Enter the x ");
            x=input1.nextInt();
            System.out.println("Enter the y ");
            y=input1.nextInt();
            System.out.println("Enter the z ");
            z=input1.nextInt();
            y=x>y?x:y;
            z=y>z?y:z;
            System.out.println("The largest of the three numbers is"+ z);
           
            @SuppressWarnings("resource")
            Scanner input11=new Scanner(System.in);
            int month;
            System.out.println("Enter the month ");
            month=input11.nextInt();
            if(month>=3&&month<=5){
                System.out.println("This month is spring");
                    }
            else if(month>=6&&month<=8){
                System.out.println("This month is summer");
                    }
            else if(month>=9&&month<=11){
                System.out.println("This month is autumn");
                    }
            else if(month==12){
                System.out.println("This month is winter");
                    }       
            else if(month>=1&&month<=2){
                System.out.println("This month is winter");
                    }
            else{
                System.out.println("Error!");
                    }
           
            @SuppressWarnings("resource")
            Scanner input111=new Scanner(System.in);
            int month1;
            System.out.println("Enter the month ");
            month1=input111.nextInt();
            switch (month1)
            {
            case 1: case 2: case 12:
                System.out.println("This month is winter");
                break;
            case 3: case 4: case 5:
                System.out.println("This month is spring");
                break;
            case 6: case 7: case 8:
                System.out.println("This month is summer");
                break;
            case 9: case 10: case 11:
                System.out.println("This month is autumn");
                break;
            default:
                System.out.println("Error!");
                break;
            }
       
            int i=1;
            do{
                System.out.println("i="+i);
                i++;
                }while(i<1);
           
            int j=1;
            while(j<1){
                System.out.println("j="+j);
                j++;
                }
           
            for(int k=1;k<3;k++)
            {
            System.out.println("k="+k);
            }
           
            int q=1;
            for(System.out.println("a");q<3;System.out.println("c"))
                {
                System.out.println("d");
                q++;
                }
        }
    }

  • 相关阅读:
    《CUDA并行程序设计:GPU编程指南》
    《设计搜索体验:搜索的艺术与科学》
    《iOS应用逆向工程:分析与实战》
    《实战突击:PHP项目开发案例整合(第2版)(含DVD光盘1张)》
    《完美幻灯片设计的黄金法则》
    《Haskell趣学指南》
    《全程软件测试(第2版)》
    【互动出版网】2013双12全场科技类图书6.5折封顶
    【互动出版网】新书五折限量抢——图书超低价
    c# (ENUM)枚举组合类型的谷歌序列化Protobuf
  • 原文地址:https://www.cnblogs.com/hhr1998/p/7640555.html
Copyright © 2011-2022 走看看