switch语句是必须要写default吗?可不可以不写?
switch(select){
case"+":
answer=txt1+txt2;
break;
case"-":
answer=txt1-txt2;
break;
case"*":
answer=txt1*txt2;
break;
case"/":
answer=txt1/txt2;
break;
}
switch(select){
case"+":
answer=txt1+txt2;
break;
case"-":
answer=txt1-txt2;
break;
case"*":
answer=txt1*txt2;
break;
case"/":
answer=txt1/txt2;
break;
}
2016-07-26
举报