misc.c

来自「A order algoritm comparison by the C tim」· C语言 代码 · 共 53 行

C
53
字号
#include "in.h"#include "func.h"/*------------------------------------------------------------------- * Function:   readArray * Purpose:    read in the contents of the array A * Input arg:  n, the number of elements to be read * Output arg: A, the array */void readArray(int A[], int n) {   int i;   for (i = 0; i < n; i++)   {   fprintf (stderr,"[@] Please insert the element %d of array [@] :",i);   fscanf(stdin,"%d", &A[i]);   }}  /* readArray *//*------------------------------------------------------------------- * Function:   printArray * Purpose:    print the contents of the array A * Input args:   *    n, the number of elements to be read *    A, the array */void printArray(int A[], int n) {   int i;   for (i = 0; i < n; i++)    printf("[%d] ", A[i]);   printf("\n");}  /* printArray *//*------------------------------------------------------------------- * Function:   randArray * Purpose:    empty an array A[length_array] with random elements  *	       if randomize is set to 1 else the random numbers are  *	       always the same. * Input args: *    lenght_array the length of array *    A, 	   the array *    range_random is the range of casual nubers *    randomize    the alg var */void randArray(int A[],int range_random,int length_array,int randomize){ int i=0; if(randomize==1)  update_seed(); else seed=10000; for (i;i<length_array ;i++) A[i]=l_int_rand(range_random);}

⌨️ 快捷键说明

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