返回列表 發帖
  1. import java.util.Scanner;

  2. public class Ch44 {

  3.         public static void main(String[] args) {
  4.                 int ans;
  5.                 Scanner s=new Scanner(System.in);
  6.                 System.out.println("<簡單的小學知識題>");
  7.                 System.out.println("請問過年到紅包為發生什麼事?(1)自己存起來 (2)跟媽媽五五分(3)被媽媽收走,長大再還你 (4)被媽媽收走,長大了還是不會還你 ");
  8.                 while(true)
  9.                 {
  10.                         System.out.println("請回答:");

  11.                         ans=s.nextInt();
  12.                         switch(ans)
  13.                         {
  14.                         case 1:
  15.                                 System.out.println("想得美");
  16.                                 break;
  17.                         case 2:
  18.                                 System.out.println("不是五五分,是十零分");
  19.                                 break;
  20.                         case 3:
  21.                                 System.out.println("從小聽到大還聽不膩嗎");
  22.                                 break;
  23.                         case 4:
  24.                                 System.out.println("唉,這強盜永遠是合法的啊");
  25.                                 break;
  26.                         default:
  27.                                 System.out.println("沒有這個答案不要再逃避了");
  28.                         }




  29.                 }

  30.         }

  31. }
複製代碼

TOP

返回列表