Hi,
I am new to C++ and I cannot seem to figure out what is wrong with my code. It looks fine to me but when I try to create an object of class Location I get this error which I do not understand the meaning to. Could someone please help me explain this problem?
Thank you
Chris
#include<stdio. h>
#include <math.h>
double findAverage (double [], double);
double findmax (double [], double);
double findmin (double [], double);
int main ()
{
double avg;
//double max, min;
/* max is to used for the Highest grade
min for the lowest grade
avg for the average grade
dif for the deviation */
#define SIZE 11
double grades[SIZE]={89,94,19.67,7 8,89,37,34,67,9 0,87};
avg=findAverage (grades, 11);
int i;
for (i=0; i < 11; i++)
{
printf("Grade\t Deviation\n -----\t ---------\n &%lf\t %lf\n",grades[i], grades[1]-avg);
}
printf("Average = %lf\n Highest Grade = %lf\n Lowest Grade = %lf",avg,findma x(grades, SIZE),findmin(g rades, SIZE));
return 0;
}
double findAverage(dou ble value[],const, SIZE = 11)
{
int i;
double sum=0.0;
for (i=0; i<11; i++) /* Sum of Grades */
sum= sum+value[i];
return (sum/11); /* Calculates and returns the average */
}
double findmax(int vals[], double numels)
{
int i,max=vals[0];
for (i=1; i<numels;i++)
if (max < vals[1])
max=vals[i];
return (max);
}
double findmin(int vals[], double numels)
{
int i,min=vals[0];
for (i=1; i<numels;i++)
if (min > vals[1])
min=vals[i];
return (min);
}
I am new to C++ and I cannot seem to figure out what is wrong with my code. It looks fine to me but when I try to create an object of class Location I get this error which I do not understand the meaning to. Could someone please help me explain this problem?
Thank you
Chris
#include<stdio. h>
#include <math.h>
double findAverage (double [], double);
double findmax (double [], double);
double findmin (double [], double);
int main ()
{
double avg;
//double max, min;
/* max is to used for the Highest grade
min for the lowest grade
avg for the average grade
dif for the deviation */
#define SIZE 11
double grades[SIZE]={89,94,19.67,7 8,89,37,34,67,9 0,87};
avg=findAverage (grades, 11);
int i;
for (i=0; i < 11; i++)
{
printf("Grade\t Deviation\n -----\t ---------\n &%lf\t %lf\n",grades[i], grades[1]-avg);
}
printf("Average = %lf\n Highest Grade = %lf\n Lowest Grade = %lf",avg,findma x(grades, SIZE),findmin(g rades, SIZE));
return 0;
}
double findAverage(dou ble value[],const, SIZE = 11)
{
int i;
double sum=0.0;
for (i=0; i<11; i++) /* Sum of Grades */
sum= sum+value[i];
return (sum/11); /* Calculates and returns the average */
}
double findmax(int vals[], double numels)
{
int i,max=vals[0];
for (i=1; i<numels;i++)
if (max < vals[1])
max=vals[i];
return (max);
}
double findmin(int vals[], double numels)
{
int i,min=vals[0];
for (i=1; i<numels;i++)
if (min > vals[1])
min=vals[i];
return (min);
}
Comment