2007-12-14 13:16:24娃娃♡°
notebookV
//跟電腦比大小
import java.util.*; //*代表全部宣告
public class A
{
public static void main(String args[])
{
Random randomNumbers = new Random();
Scanner input = new Scanner(System.in);
int dice = 0;
int choice = 0;
System.out.print(”1.大2.小 0.離開:”);
choice=input.nextInt();
while(choice != 0)
{
dice=randomNumbers.nextInt(6)+1;
if(dice<=3&& choice==2)
System.out.println(”贏”);
if(dice<=3&& choice==1)
System.out.println(”輸”);
if(dice>3&& choice==1)
System.out.println(”贏”);
if(dice>3&& choice==2)
System.out.println(”輸”);
System.out.println(”1.大2.小 0.離開:”);
choice=input.nextInt();
}
}
}
import java.util.*; //*代表全部宣告
public class A
{
public static void main(String args[])
{
Random randomNumbers = new Random();
Scanner input = new Scanner(System.in);
int dice = 0;
int choice = 0;
System.out.print(”1.大2.小 0.離開:”);
choice=input.nextInt();
while(choice != 0)
{
dice=randomNumbers.nextInt(6)+1;
if(dice<=3&& choice==2)
System.out.println(”贏”);
if(dice<=3&& choice==1)
System.out.println(”輸”);
if(dice>3&& choice==1)
System.out.println(”贏”);
if(dice>3&& choice==2)
System.out.println(”輸”);
System.out.println(”1.大2.小 0.離開:”);
choice=input.nextInt();
}
}
}
上一篇:notebookIV
下一篇:Notebook VI