某種紙牌游戲,三人一起玩一幅牌,每人17張,5張及以上的連續(xù)單牌(不分花色)稱為順子,順子最大到K,如“A,2.3,4,5,6”是長度為6的順子。編寫程序,判斷游戲剛開始時某玩家有沒有順子,最長的順子是幾張實現(xiàn)上述功能的B程序代碼如下,但加框處代碼有錯,請改正 Const n=17 Dim a(n) As Integer Private Sub Command1_ Click( ) Dim max As Integer,count As Integer Dim i As Integer,Ag Integer count=0:max=0 i=1 Do While i<=n-1 ′① j=i+1 Do While j<=n IfThen′② j=j+1 count=count+I
Elself a(j)=a(j-1)Then j=j+1 Else Exit Do End If Loop i=j If count>max Then max“count Loop If mxa<5 Then Label2.Caption=“無順子“ Else Label2.Caption=“最長順子長度:“+Str(max) End If End Sub Private Sub Fora Load ( ?。?br />'獲取17張牌的牌面數(shù)值(J、Q、K,A分別對應11、12、13,1),升序存儲在數(shù)組a中 ‘代碼略 End Sub