# include<stdio.h>
# include<stdlib.h>
int main()
{
int xx[200],ji=0,ou=0;
void getnum(int *p);
void jiou(int *p,int &j,int &o);
double average(int *p);
getnum(xx);
jiou(xx,ji,ou);
printf("奇数个数为:%d\n偶数个数为:%d\n",ji,ou);
printf("下标为奇数的元素的算数平均值为:%10.2f\n",average(xx));
return 0;
}
void getnum(int *p)
{
for(int *i=p;i<200+p;i++)
*i=rand()%100;
}
void jiou(int *p,int & j,int& o)
{
for(int *i=p;i<200+p;i++)
{
if(*i%2==0)
o++;
else j++;
}
}
double average (int *p)
{
double aver=0;
for(int *i=p+1;i<200+p;i+=2)
aver+=*i;
aver/=100;
return aver;
}