I'm not too sure about the logic but here goes. I've removed all your errors about N and n. Something like o and 0. I'm not practicing C++ by profession so I'm not sure about what you did in school but using Turbo C is quite old. Visual C++ 2003 and up is complaint to standard 99. Or better yet the GNU Compilers are good.
There is also an upcoming standard for C++ by ANSI (I think) this coming 2009. I just don't know the details. Anyway, here's your code. And oh, please use [code][/code] when posting code.
Code:
#include <stdio.h>
#define N 7
void input(float a[], int n) {
printf("Enter the scores of 7 judges: ");
for (int i = 0; i < n; i++) {
scanf("%f", &a[i]);
}
}
float highest (float a[], int n) {
int i;
float highest;
highest=a[0];
for (i=1; i<n; i++)
if (highest<a[i])
highest=a[i];
return highest;
}
float lowest (float a[], int n) {
int i;
float lowest;
lowest=a[0];
for (i=1; i<n; i++)
if (lowest>a[i])
lowest = a[i];
return lowest;
}
float average (float highest, float lowest, float a[], int n) {
int i;
float highlow, ave, x, sum = 0;
highlow = highest + lowest;
for (i=0; i<n; i++)
sum = sum + a[i];
x = sum - highlow;
ave = x/5.0;
return ave;
}
int main() {
float a[N];
float Highest, Lowest, Average;
input (a, N);
Highest = highest (a, N);
Lowest = lowest (a, N);
Average = average (Highest, Lowest, a, N);
printf ("Highest : %.2f", Highest);
printf ("Lowest : %.2f", Lowest);
printf ("Average : %.2f", Average);
return 0;
}
There are still warnings though and I don't bother solving them. I used VC2005 so you might want to convert it if anything goes wrong with Turbo C.
Best Regards!