- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- re:
- for(int j=1; j<=13; j++)
- {
- int r=rand()%10;
- if(r==0)
- {
- if(j==1)
- cout<<"您抽到的牌是: "<<char(3)<<"A "<<endl;
- else if(j==11)
- cout<<"您抽到的牌是: "<<char(3)<<"J ";
- else if(j==12)
- cout<<"您抽到的牌是: "<<char(3)<<"Q ";
- else if(j==13)
- cout<<"您抽到的牌是: "<<char(3)<<"K ";
- else
- cout<<"您抽到的牌是: "<<char(3)<<j<<" ";
- system("pause");
- system("cls");
- goto re;
- }else if(r==2)
- {
- goto re;
- if(j==1)
- cout<<"您抽到的牌是: "<<char(3)<<"A ";
- else if(j==11)
- cout<<"您抽到的牌是: "<<char(3)<<"J ";
- else if(j==12)
- cout<<"您抽到的牌是: "<<char(3)<<"Q ";
- else if(j==13)
- cout<<"您抽到的牌是: "<<char(3)<<"K ";
- else
- cout<<"您抽到的牌是: "<<char(3)<<j<<" ";
- system("pause");
- system("cls");
-
- }else if(r==2)
- {
- goto re;
- if(j==1)
- cout<<"您抽到的牌是: "<<char(3)<<"A ";
- else if(j==11)
- cout<<"您抽到的牌是: "<<char(3)<<"J ";
- else if(j==12)
- cout<<"您抽到的牌是: "<<char(3)<<"Q ";
- else if(j==13)
- cout<<"您抽到的牌是: "<<char(3)<<"K ";
- else
- cout<<j<<" ";
- system("pause");
- system("cls");
-
- }else
- {
- goto re;
- if(j==1)
- cout<<"您抽到的牌是: "<<char(3)<<"A ";
- else if(j==11)
- cout<<"您抽到的牌是: "<<char(3)<<"J ";
- else if(j==12)
- cout<<"您抽到的牌是: "<<char(3)<<"Q ";
- else if(j==13)
- cout<<"您抽到的牌是: "<<char(3)<<"K ";
- else
- cout<<"您抽到的牌是: "<<char(3)<<j<<" ";
- system("pause");
- system("cls");
-
- }
-
- }
- system("pause");
- return 0;
- }
複製代碼 |