用eclipse编译出问题求解释
importjava.util.Scanner;publicclasst{publicstaticvoidmain(Stringargs[]){Scannerinput=...
import java.util.Scanner;
public class t
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
System.out.println("This is a simple game");
for (char i = 'y'; i == 'y'; i = (char)System.in.read())
{
System.out.println("输入1-剪刀,2-石头,3-布:");
int a = input.nextInt();
int b = ((int)Math.random() * 10) % 3 + 1;
if (a == b)
System.out.println("平局!");
if (b - a == 1 || (b == 3 && a == 1))
System.out.println("你输了!");
if (a - b == 1 || (a == 3 && b == 1))
System.out.println("你赢了!");
i = (char)System.in.read();
};
};
} 展开
public class t
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
System.out.println("This is a simple game");
for (char i = 'y'; i == 'y'; i = (char)System.in.read())
{
System.out.println("输入1-剪刀,2-石头,3-布:");
int a = input.nextInt();
int b = ((int)Math.random() * 10) % 3 + 1;
if (a == b)
System.out.println("平局!");
if (b - a == 1 || (b == 3 && a == 1))
System.out.println("你输了!");
if (a - b == 1 || (a == 3 && b == 1))
System.out.println("你赢了!");
i = (char)System.in.read();
};
};
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询