数组名作为函数参数--求数组平均数

int main()
{

float average(float array[10]);
float score[10], aver;
int i;
std::cout << "请输入10个数值:";
printf("\n");
for ( i = 0; i < 10; i++)
{
	scanf("%f", &score[i]);
}
printf("\n");
aver = average(score);
printf("average score is %5.2f\n", aver);
return 0;

return 0;

}

float average(float array[10])
{
int i;
float aver, sum = 0;
for ( i = 0; i < 10; i++)
sum = sum + array[i];
aver = sum / 10;

return aver;

}

上一篇:Unity shader各向异性的头发效果


下一篇:013-Python入门(元组)