指针7

作者: 时间:2020-07-09 点击数:

方法2:
      void count2(int *p,int n,int bb[])    {
      int i;
   for(i=0;i<n;i++)
   if (*(p+i)==100) bb[4]++;
   else if (*(p+i)<60) bb[0]++;
   else
        bb[*(p+i)/10-5]++;    }

int fsd[5]={0};
   count2(&score[0][0],50,fsd);

void count(int *p,int n,int *p1,int *p2,int *p3,int *p4,int *p5) {
    int i,a,b,c,d,e;
 a=b=c=d=e=0;
 for(i=0;i<n;i++)
 if (*(p+i)>=90) a++;
 else if (*(p+i)>=80) b++;
 else if (*(p+i)>=70) c++;
 else if (*(p+i)>=60) d++;
 else
      e++;
 *p1=a;*p2=b;*p3=c;*p4=d;*p5=e; }

上一页 [1] [2] [3] [4] 下一页

Copyright© 2020 Anyang Institute of Technology.All rights reserved.

学院地址:河南省安阳市黄河大道西段