?? randnumber.cpp
字號:
#include "fstream.h"
#include "base.h"
#include "time.h"
void Randnumber()
{//產生隨機數保存在a.txt~j.txt中
fstream File;
int a[50000];
int i,j;
char name[6]={'a','.','t','x','t'};
char *p;
srand((unsigned)time(NULL)); //使得不同時間產生的隨機數不同
for(j=0;j<=9;j++)
{
p=&name[0];
File.open(p,ios::out);
if (!File){
cout<<"\t\t\t\t文件打開失敗!"<<endl;
exit(0);
}
for(i=0;i<50000;i++)
{
a[i]=rand();
File<<setw(8)<<a[i];
}
File.close();
name[0]+=1;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -