⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.c

📁 归并外排序,要先运行file程序
💻 C
字号:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define NUM 50

void main(void)
{
	int source1[NUM];
	int source2[NUM];
	int i=NUM,j=NUM;
	FILE *fp;
	srand(time(NULL));
	for(i=0;i<NUM;i++)
	{
		source1[i]=rand()%2000;
	}
	/****************************************/
	/*写文件 data1.dat*/
    fp=fopen("e:\\data1.dat","wb");
	if(fp==NULL)
	{
		printf("the file cannot be open.\n");
		exit(0);
	}
    fwrite(source1,sizeof(int),NUM,fp);
	fclose(fp);
	for(j=0;j<NUM;j++)
	{
		source2[j]=rand()%2000;
	}
	/********************************************/
	/*写文件 data2.dat*/
    fp=fopen("e:\\data2.dat","wb");
	if(fp==NULL)
	{
		printf("the file cannot be open.\n");
		exit(0);
	}
	fwrite(source2,sizeof(int),NUM,fp);
	fclose(fp);
    /********************************************/
	printf("File write success!\n");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -