求救!这个C语言程序哪里错了?怎么改?很急啊,明天就答辩了

来源:百度知道 编辑:UC知道 时间:2024/06/15 10:41:34
#include<stdio.h>
#include<conio.h>
main()
{
float wares[8];
float aver,highestP,lowestP;
void readprice(float price[8]);
float averPrice(float price[8]);
float highPrice(float price[8]);
float lowePrice(float price[8]);
void prtprice(float price[8],float ave);
readprice(wares);
aver=averPrice(wares);
highestP=highPrice(wares);
lowestP=lowPrice(wares);
printf("The highest Price=%6.2f\n",highestP);
printf("the lowest Price=%6.2f\n",lowestP);
printf("The average Price=%6.2f\n",aver);
prtprice(wares,aver);
getch();
}
void readprice(float price[8])
{
int i;
printf("Enter 8 ware’s price:\n");
for(i=0;i<8;i++)
scanf("%f",&price[i]);
printf("The price of 8 wares is :\n");
for (i=0;i<8;i++)
printf("%6.2f\t",price[i])

楼上在瞎说了,提问者的程序里在调用函数前,已经进行了声明,这没有错。(这个声明一般都放在main前面,但是像提问者那样,放在main里面在调用前声明也是正确的。)

这个程序的致命错误是把大小写搞混了。

float averPrice(float price[8]);
float highPrice(float price[8]);
float lowePrice(float price[8]);

把函数名里的"P" 都变成小写的"p",就行了。
记住,C语言里大小写是有区别的。

函数的实现应该放到main函数的前面,或者在main函数之前加上函数申明