herrDeng網內搜尋

自訂搜尋

Ads

2011年4月14日 星期四

switch-case

請用switch-case, 輸入int格式x,
x=1 輸出字串"星期一"
x=2 輸出字串"星期二"
x=3 輸出字串"星期三"
x=4 輸出字串"星期四"
x=5 輸出字串"星期五"
x=6 輸出字串"星期六"
x=7 輸出字串"星期日"

44 則留言:

B9933070 提到...

import java.util.*;
public class BB {
public static void main(String[] args)
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("請輸入1~7");
x=input.nextInt();
switch(x){
case 1 :
System.out.println("星期一");
break;
case 2 :
System.out.println("星期二");
break;
case 3 :
System.out.println("星期三");
break;
case 4 :
System.out.println("星期四");
break;
case 5 :
System.out.println("星期五");
break;
case 6 :
System.out.println("星期六");
break;
case 7 :
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");


}
}while (x!=0);


}
}

b9933115 提到...

import java.util.*;
public class s {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");


break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

b9933109 提到...

import java.util.*;
public class hello
{
public static void main(String[] args)
throws Exception
{
Scanner input=new Scanner(System.in);
int x;
do
{
System.out.println("輸入日期");
x=input.nextInt();
switch(x)
{
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("輸入錯誤");
}
}
while(x!=0);
}
}

B9933063 提到...

import java.util.*;
public class wen {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

b9933071 提到...

import java.util.*;
public class ivy{
public static void main(String []args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.println("輸入星期");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;

}
}while(x!=0);
}
}

B9933090 提到...

import java.util.*;
public class s {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

B9733202 提到...

import java.util.*;
class Switch
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("請輸入1~7的整數");
int x = input.nextInt();
switch(x)
{
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("輸入錯誤");
}
}
}

b9933092 提到...

import java.util.*;
public class b9933092 {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

A9933058 提到...

import java.util.*;
public class bb1{
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
System.out.println("請輸入");
do{
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("結束");
}
}while (x!=0);
}
}

B9933067 提到...

public class W {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
⋯⋯do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

B9933065 提到...

import java.util.*;
class dd {
public static void main(String [] arg)throws Exception{
Scanner input=new Scanner (System.in);
int x;
do{
System.out.println("input");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
break;
}
}while(x!=0);
}
}

B9933061 提到...

import java.util.*;
public class java2{
public static void main(String []argv) throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.println("輸入");
x=input.nextInt();
switch(x){
case 1:
System.out.println("禮拜一");
break;
case 2:
System.out.println("禮拜二");
break;
case 3:
System.out.println("禮拜三");
break;
case 4:
System.out.println("禮拜四");
break;
case 5:
System.out.println("禮拜五");
break;
case 6:
System.out.println("禮拜六");
break;
case 7:
System.out.println("禮拜日");
break;
}

}while (x!=0);
}
}

B9933116 提到...

import java.util.*;
public class Switchcase {
public static void main(String [] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.println("輸入數字 猜星期幾?");
x=input.nextInt();
switch(x){
case 0:
System.out.println("結束");
break;
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("OUT OF RANGE!!");
}
}while(x!=0);
}
}

B9933100 提到...

import java.util.*;
class java
{
public static void main(String [] args)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.println("請輸入星期幾");
int x;
do{

x=input.nextInt();
switch(x)
{
case 1:
System.out.println("禮拜一");
break;
case 2:
System.out.println("禮拜二");
break;
case 3:
System.out.println("禮拜三");
break;
case 4:
System.out.println("禮拜四");
break;
case 5:
System.out.println("禮拜五");
break;
case 6:
System.out.println("禮拜六");
break;
case 7:
System.out.println("禮拜日");
break;
default:
System.out.println("錯誤");
}
}while(x!=0);
}
}

B9933068 提到...

import java.util.*;
class sichcase
{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
int x;
do
{
x=input.nextInt();
switch (x)
{
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
}

} while (x!=0);

}
}

B9833034 提到...

import java.util.*;
public class s {
public static void main(String[] args) throws Exception
{
Scanner input=new Scanner(System.in);
int x ;
do
{
System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

B9933080 提到...

import java.util.*;
public class cyu {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

B9933085 提到...

import java.util.*;
class week {
public static void main(String[] args)throws Exception
{
Scanner input =new Scanner(System.in);
int x;
{System.out.println("輸入數字");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
break;}

}

}
}

b9933114 提到...

import java.util.*;
public class switchcase {
public static void main(String[]args)throws Exception
{ Scanner input=new Scanner (System.in);
int x;
do{System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("沒有這個數字");
}
}while(x!=0);
}
}

B9933064 提到...

import java.util.*;
public class SwitchCase {
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.print("x=");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
}
}while(x!=0);
}
}

b9933076 提到...

import java.util.*;
public class Switchcase {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入數字");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;

default:
System.out.println("沒這個日子");

}
}while (x!=0);

}
}

B9933078 提到...

import java.util.*;
public class switchcase {
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.print("x=");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
}
}while(x!=0);
}
}

B9933069 提到...

import java.util.*;
public class hello {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

a9933056 提到...

import java.util.*;
public class at {
public static void main(String [] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.println("輸入數字");
x=input.nextInt();
switch(x){
case 1:
System.out.println("禮拜一");
break;
case 2:
System.out.println("禮拜二");
break;
case 3:
System.out.println("禮拜三");
break;
case 4:
System.out.println("禮拜四");
break;
case 5:
System.out.println("禮拜五");
break;
case 6:
System.out.println("禮拜六");
break;
case 7:
System.out.println("禮拜日");
break;
default:
}
}while(x!=0);
}
}

b9933074 提到...

import java.util.*;
public class xxx
{
public static void main(String[] arg)
throws Exception
{
Scanner input=new Scanner(System.in);
int x;
do
{
System.out.println("輸入1~7");
x=input.nextInt();
switch(x)
{
case 7:
System.out.println("星期天");
break;
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
default:
System.out.println("查無此日");
}
}
while(x!=99);
System.out.println("退出!");
}
}

B9933106 提到...

import java.util.*;
public class mlb {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("錯誤");
break;
}
}while (x!=0);

}
}

b9933098 提到...

import java.util.*;
public class hello {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

b9933083 提到...

import java.util.*;
public class s {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

b9933102 提到...

import java.util.*;
public class phe {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

b9933103 提到...

import java.util.*;
public class thx {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

A9933059 提到...

import java.util.*;
public class book {
public static void main(String [] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.println("輸入數字");
x=input.nextInt();
switch(x){
case 1:
System.out.println("禮拜一");
break;
case 2:
System.out.println("禮拜二");
break;
case 3:
System.out.println("禮拜三");
break;
case 4:
System.out.println("禮拜四");
break;
case 5:
System.out.println("禮拜五");
break;
case 6:
System.out.println("禮拜六");
break;
case 7:
System.out.println("禮拜日");
default:
}
}while(x!=0);
}
}

b9933075 提到...

import java.util.*;
public class hello {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

B9933066 提到...

import java.util.*;
public class SwitchCase {
public static void main(String[] args) throws Exception{
Scanner input=new Scanner(System.in);
int x;
{
System.out.println("請輸入數字");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
}
}
}
}

B9933108 提到...

import java.util.*;
public class ggggg{
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
System.out.println("輸入");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
break;
}
}
}

b9933110 提到...

import java.util.*;
public class Switch {
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
System.out.print("請輸入星期:");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("輸入錯誤");

}
}

}

b9933110 提到...

import java.util.*;
public class Switch {
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
System.out.print("請輸入星期:");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("輸入錯誤");

}
}

}

b9933089 提到...

import java.util.*;
public class SwitchCase {
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.print("x=");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
}
}while(x!=0);
}
}

b9933087 提到...

import java.util.*;
public class SwitchCase {
public static void main(String[] args)
throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.print("x=");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
}
}while(x!=0);
}
}

b9933097 提到...

import java.util.*;
public class week {
public static void main(String[] args)throws Exception
{
Scanner input=new Scanner(System.in);
int x;
System.out.println("輸入數字");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("輸入錯誤");
break;
}
}
}

b9933075 提到...

import java.util.*;
public class Triangle {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

B9933101 提到...

import java.util.*;
public class help{
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");
break;
}
}while (x!=0);

}
}

b9933093 提到...

import java.util.*;
public class switchcase
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.print("x=");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("錯誤");
}
}while(x!=0);
}
}

b9933094 提到...

import java.util.*;
public class SwitchCase
{
public static void main(String[] args) throws Exception{
Scanner input=new Scanner(System.in);
int x;
do{
System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");
break;
default:
System.out.println("沒有這個數字");
}
}while(x!=0);
}

}

B9933072 提到...

import java.util.*;
public class s {
public static void main(String[] args) throws Exception
{ Scanner input=new Scanner(System.in);
int x ;
do{ System.out.println("輸入星期幾");
x=input.nextInt();
switch(x){
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期日");

break;
default:
System.out.println("沒有這個數字");

}
}while (x!=0);

}
}

Related Posts Plugin for WordPress, Blogger...

熱門文章