C++ 沒有極限
[C++] 純文本查看 復制代碼 #include<cstdlib>
#include<ctime>
#include<iostream>
#include<algorithm>
using namespace std;
//定義 MAX_SIZE 為 39
#define MAX_SIZE 39
int main()
{
//初始化亂數
srand(time(NULL));
//存放編號
int card[MAX_SIZE];
//先依照順序放好
for(int i=0 ; i<MAX_SIZE ; ++i)
{
card[i]=i+1;
}
//C++ 內建打亂 in algorithm
random_shuffle(card,card+MAX_SIZE);
cout<<"C++ 內建打亂 : "<<endl;
for(int i=0; i<MAX_SIZE ;++i)
{
cout<<card[i]<<' ';
}
cout<<endl;
} |