class DouDiZhu
{
public static void main(String[] args)
{
//定义三个人斗地主
String[] renshu = {"张三","李四","王五"};
//定义若干张牌
String[] paishu = {"黑桃Q","黑桃K","黑桃A","红桃K","红桃J","方片10","大王","方片K","方片Q","小王","梅花J","梅花A"};
//发牌(循环)
int i = 0;
while(i<12)//共12张牌
{
String card = paishu[i];//牌数
String p = renshu[i++ % 3];//人数
System.out.println(p+":"+card+" ");//输出人 牌
if( i % 3 == 0)
{
System.out.println();//每发完一圈,换行
}
}
}
}
|
|