當我執行這遊戲時 遊戲結束時 我有設定2個選項
分別是 在玩一次 及 結束程式
但當我執行再玩一次 卻有問題
有大大能幫忙看一下怎麼改嗎 謝謝

附上程式
#include <iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int random( bool a[] ) {
int card;
do {
card = rand() % 52;
}while( a[card] == true );
a[card] = true;
return card;
}
int card( int x ) {
x %= 13;
if( x < 10 ) {
cout << x + 1 << " ";
return x + 1;
} else if( x == 10 )
cout << "J ";
else if( x == 11 )
cout << "Q ";
else if( x == 12 )
cout << "K ";
return 10;
}
int main() {
int z;
for(z=1;z<3;z++) {
srand(time(NULL));
bool a[52];
int p = 0, cp = 0, t, ct, cc, c;
char *s[] = {"黑桃 ", "梅花 ", "菱形","紅心 "};
char ch;
do {
if( cp < 17 ) {
cc = random( a );
cout << s[ cc % 4 ];
ct = card( cc );
if( cp + ct > 21 ){
cout << "莊家 " << cp + ct << " 點爆了,你贏囉!" << endl;
break;
} else {
if( ct == 1 && cp == 10 )
cp = 21;
else
cp += ct;
cout << "莊家 " << cp << " 點" << endl;
}
} else if( cp >= 17 ) {
cout << "莊家 " << cp << " 點,不補牌" << endl;
}
if( ch != 'n' && ch != 'N' ){
c = random( a );
cout << s[ c % 4 ];
t = card( c );
if( p + t > 21 ){
cout << "你 " << p> break;
} else {
if( t == 1 && p == 10 )
p = 21;
else
p += t;
cout << "你 " << p> if( p < 21 ){
cout << "要補牌嗎?(y/n)";
cin >> ch;
system("cls");
} else
ch = 'n';
}
} else {
cout << "你 " << p> if( cp >= 17 ) {
if( p > cp )
cout << "你贏囉!" << endl;
else if( p < cp )
cout << "你輸呵呵!" << endl;
else
cout << "沒輸沒贏 !" << endl;
break;
}
}
}while( cp <= 21 && p <= 21 );
cout<<"再玩一次請按1"<<endl;
cout<<"退出請按2"<<endl;
cin>>z;
system("cls");
}
return 0;
}