问题描述
usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespacepuke{publicenumpk//定义枚举{A=1,er,san,si,wu,liu,qi,ba,jiu,shi,J,O,K}publicenumhuase//定义枚举{heitao,hongtao,fanpian,meihua}publicclasspai{publicreadonlypkPK;publicreadonlyhuasehs;privatepai(){}publicpai(huasenewhs,pknewPK){PK=newPK;hs=newhs;}publicoverridestringToString(){return"the"+hs+"of"+PK+"s";}}publicclasswzp{privatepuke.pai[]bcp;publicwzp()//构造函数一副完整的牌{bcp=newpai[52];for(inti=0;i<4;i++){for(intj=1;i<14;j++){bcp[i*13+j-1]=newpai((huase)i,(pk)j);}}}publicpaifanhui(inti){if(0<i&&i<52)returnbcp[i];else{thrownewException("非预期的范围");//抛出异常}}publicvoidxipai(){pai[]bb=newpai[52];bool[]bbb=newbool[52];Randomsjs=newRandom();for(inti=0;i<52;i++){intbcsjs=0;boolbbbb=false;while(bbbb=false){bcsjs=sjs.Next(52);if(bbb[i]==false){bbbb=true;}}bbb[i]=true;bb[i]=cards[i];}bb.CopyTo(cards,0);}}}
解决方案
解决方案二:
没人解决我自己来解决usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespacepuke{publicenumpk//定义枚举{A=1,er,san,si,wu,liu,qi,ba,jiu,shi,J,O,K}publicenumhuase//定义枚举{heitao,hongtao,fanpian,meihua}publicclasspai{publicreadonlypkPK;publicreadonlyhuasehs;privatepai(){}publicpai(huasenewhs,pknewPK){PK=newPK;hs=newhs;}publicoverridestringToString(){return"the"+hs+"of"+PK+"s";}}publicclasswzp{privatepuke.pai[]bcp;publicwzp()//构造函数一副完整的牌{bcp=newpai[52];for(inti=0;i<4;i++){for(intj=1;j<14;j++){bcp[i*13+j-1]=newpai((huase)i,(pk)j);}}}publicpaifanhui(inti){if(0<i&&i<52)returnbcp[i];else{thrownewException("非预期的范围");//抛出异常}}publicvoidxipai(){pai[]bb=newpai[52];bool[]bbb=newbool[52];Randomsjs=newRandom();for(inti=0;i<52;i++){intbcsjs=0;boolbbbb=false;while(bbbb=false){bcsjs=sjs.Next(52);if(bbb[i]==false){bbbb=true;}}bbb[i]=true;bb[i]=cards[i];}bb.CopyTo(cards,0);}}}
解决方案三:
..........