正在加载图片...
int table fill(int all int max) fint count =0; for count max, count++) if ( scanf ("i" &a[count]!= 1) break; /*kick out on error * return count void table avg cnts(int a[], int n, double avg) int i /★ index*/ int above =0 ★ above average*/ int bel。w=0; / below average * for(立=0;主<n;i++) if (a[i]> avg) above++ else if (all]< avg) below++ printf(" There are %i values above average. \n", above) printf("There are i values below average. n below)i PROGRAM MINGMETHDOLODGY AND SOFTWAREENGINEERING 港城市大 Copyrighto1998 Angus Wu ol Hone KonePROGRAMMING METHDOLODGY AND SOFTWARE ENGINEERING Copyright©1998 Angus Wu int table_fill(int a[], int max) {int count = 0; for (; count < max; count++) if (scanf("%i", &a[count]) != 1) break; /* kick out on error */ return count; } void table_avg_cnts(int a[], int n, double avg) { int i; /* index */ int above = 0; /* above average */ int below = 0; /* below average */ for (i = 0; i < n; i++) if (a[i] > avg) above++; else if (a[i] < avg) below++; printf("There are %i values above average.\n", above); printf("There are %i values below average.\n", below); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有