本帖最後由 周雍程 於 2014-8-9 16:48 編輯
- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- re:
- system("cls");
- int a=rand()%4+3;
- int b=rand()%13+1;
- cout<<"您抽到的牌是: "<<char(a);
- if(b==1)
- cout<<"A ";
- else if(b==11)
- cout<<"J ";
- else if(b==12)
- cout<<"Q ";
- else if(b==13)
- cout<<"K ";
- else
- cout<<b;
- system("pause");
- goto re;
- return 0;
- }
複製代碼 |