[ C++ ] 亂數




#include <iostream>
#include <time.h>
using namespace std;
void main()
{
 int num;
 srand(time(NULL));
 num=(rand()%100)+1;   //範圍 1~100
//取 100-1000 的亂數 a=(rand() % 901) +100
 cout<<" Random Number : "<<num<<endl;
}

留言

熱門文章