import java.util.Scanner;
class DianMing
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("请输入任意数开始点名:");
int number = sc.nextInt();
String[] chs = {","张三","李四","王二","麻子","孙悟空","猪八戒"};
do{
int n = (int)(Math.random()*chs.length)+1;
for(int x=1;x<=chs.length;x++){
if(n == x){
System.out.println(chs[x]);
}
}
System.out.println("是否继续点名?继续请输入0,结束输入任意非0的数");
number = sc.nextInt();
}while(number == 0);
}
} |
|