本帖最後由 戴安利 於 2019-4-20 16:32 編輯
- #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;
- }
複製代碼 |