本帖最後由 劉得恩 於 2014-8-2 17:59 編輯
- #include <iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- char x;
- int y;
- srand(time(NULL));
- while(1)
- {
- system("CLS");
- cout<<"你抽到的牌是:";
- x=3+rand()%4;
- y=rand()%13+1;
- cout<<x;
- if(y==1)
- cout<<"A \n";
- else if(y==11)
- cout<<"J \n";
- else if(y==12)
- cout<<"Q \n";
- else if(y==13)
- cout<<"K \n";
- else
- cout<<y<<" \n";
- system("pause");
- }
- return 0;
- }
複製代碼 |