|
沙发
楼主 |
发表于 2015-10-31 20:29:23
|
只看该作者
- #include <iostream>
- //#include <string>
- #include<stdlib.h>
- #include<time.h>
- using namespace std;
- int n,r,i,j,k;
- int a[100];
- string MZ=" A 2 3 4 5 6 7 8 910 J Q K";
- char HS[4]= {6,3,5,4};
- int main()
- {
- for (i=0; i<=51; i++) a[i]=i;
- srand((int)time(NULL));
- for (i=0; i<=50; i++)
- {
- j=rand()%52;
- swap(a[i],a[j]);
- }
- for (i=0; i<=51; i++)
- {
- cout<<HS[a[i]/13];
- cout<<MZ[2*(a[i]%13)];
- cout<<MZ[2*(a[i]%13)+1];
- cout<<' ';
- if (i%13==12) cout<<endl;
- }
- return 0;
- }
复制代码 |
|