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

📄 list.c

📁 Sherwood算法消除最坏实例
💻 C
字号:
#include<stdio.h>
#include<stdlib.h>

/****** create a descending sequence of n integers ******/
main(int argc, char *argv[])
{
   int n, i, *list;
   FILE *outfp;

   if(argc == 3)
   {
      if( (outfp = fopen(argv[1], "w")) == NULL)
      {
         printf("Can't open the file!\n");
         exit(2);
      }
   }
   else
   {
      printf("Usage: %s outfile n \nNote: outfile is to store the n integer created\n", argv[0]);
      exit(1);
   }

   n = atoi(argv[2]);

   for(i = 0; i < n; i++)
      fprintf(outfp, "%d ", n - i);
   fclose(outfp);
   free(list);
   return 0;
}


⌨️ 快捷键说明

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