返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.    srand(time(NULL));
  8.    re:
  9.    system("cls");
  10.    int a=rand()%4+3;
  11.    int b=rand()%13+1;

  12.    cout<<"你抽到的牌是"<<char(a);
  13.    if(b==1)
  14.       cout<<"A"<<endl;
  15.    else if(b==11)
  16.           cout<<"J"<<endl;
  17.    else if(b==12)
  18.           cout<<"Q"<<endl;
  19.    else if(b==13)
  20.           cout<<"K"<<endl;
  21.    else
  22.         cout<<b;
  23.     cout<<endl;     
  24.    
  25.     system("pause");
  26.      goto re;
  27.     return 0;



  28. }
複製代碼

TOP

返回列表