xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 3KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-14
  • 語言: Java
  • 標簽: JAVA??拿火柴??小游戲??

資源簡介

JAVA拿火柴的小游戲,使用JDK編寫,JAVA初學者的范例程序,有出錯循環,

資源截圖

代碼片段和文件信息

import?java.util.*;
public?class?Test8{
public?static?void?main(String?args[]){

Random?rand=new?Random();
Scanner?reader=new?Scanner(System.in);
boolean?sw=false;
int?num?=?0play=0num_computercom_randplaynum;
int?amount=rand.nextInt(30)+20;


do{
?sw=false;
??try{
? Scanner?input?=?new?Scanner(System.in);?
System.out.println(“1是人先走,2是計算機先走:“);?
?? play?=?input.nextInt();
if(play>2||play<1){
sw=true;
System.out.println(“輸入錯誤,請輸入1~2之間的數。請重試。“);
}
? ???}
??catch?(InputMismatchException?e){
??? System.out.println(“對不起輸入錯誤。輸入的要數字,請重試“);//出錯提示
sw=true;
?? ??}
}
while(sw==true);?????????????//whofirstplay認證完畢
/*?比賽部分開始*/
while(amount!=0){
playnum=0;
switch(play){
case?1:
do{
sw=false;
? try{
? Scanner?input?=?new?Scanner(System.in);?
System.out.println(“目前有“+amount+“根火柴,您可以拿1~3根火柴“);?
?? playnum?=?input.nextInt();
if(playnum>3||playnum<1||amount sw=true;
System.out.println(“對不起輸入錯誤,請輸入1~3之間的數并且小于目前火柴數請重試“);
}
? ?? ?}?
?? catch?(InputMismatchException?e){
??? System.ou

評論

共有 條評論