compute-mean-coll.c

来自「对IEEE 802.11e里的分布式信道接入算法EDCA进行改进」· C语言 代码 · 共 57 行

C
57
字号
#include <stdio.h>#include <stdlib.h>/* Compute the maximum between the number in   * the second column                  *  * Input: *   src1, src2 - two columns files * *   res - two column file */int main(int argc, char **argv) {  FILE *df1 ;  	int nflows;	  float sum;  	float mean;	float mean1;		sum = 0.0;	mean =0.0;	mean1 =0.0;  if (argc != 3) {    //printf("Ussage: %s srcfile nflows \n", argv[0]);    exit(-1);  }  if (!(df1 = fopen (argv[1], "r"))) {    printf ("fopen() failed\n");    exit (1);  }  	nflows=atoi(argv[2]);		while (!feof(df1)) {				fscanf(df1, "%f%f\n", &mean, &mean1);				sum = sum + mean1 ;		  }   	printf("%f", sum/nflows);	  fclose(df1);}  

⌨️ 快捷键说明

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