rand生成随机数据

跑了N多数据,还是没有找出错误点。。。。。。。。。。。。fuck
#include <iostream>
#include <ctime>
#include <cstdio>
#include <windows.h>
using namespace std;
int main()
{
	while(1)
	{
		FILE *fp;
		fp = fopen("E:\\ACM\\POJ\\poj_3176\\in.txt","w");
		int n;
		srand(time(NULL));
		n = rand()%100;
		fprintf(fp,"%d\n",n);
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=i;j++)
			{
				fprintf(fp,"%d ",rand() % 100);
			}
			fprintf(fp,"\n");
		}
		fclose(fp);
		Sleep(5000);
		system("type in.txt");
		system("type.bat");
	}
	
    return 0;
}
 

原文地址:https://www.cnblogs.com/lgh1992314/p/5835310.html