Hello everybody, my problem is that I am receiving a "expected primary expression before ')' " message when I try to compile my proggram. Could anyone point out what I'm doing wrong. The error comes up in int main() when I try to call other functions.
struct persons
{
int studentID;
double programAvg;
double testAvg;
};
const int MAXSIZE = 20;
persons student[MAXSIZE];
int buildAr( persons []);
void displayAr( persons [], int );
int main()
{
persons student [MAXSIZE];
int i,
count;
buildAr (persons);
displayAr (persons);
system("pause");
return 0;
}
/***************************************************************
Function: buildAr
Use: opens a file to receive data used to fill the student ID number, program and test averages arrays
Arguments: the student array
Returns: number of students in an array
***************************************************************/
int buildAr( persons[]) //this function fills all 3 arrays and returns student count
{
return count; // student count//
}
/*****************************************************************
Function: displayAr
Use: display the students' ID numbers, their program and test averages, also calculate and display overall averages
Arguments: student array and student count
Returns: nothing
***************************************************************/
void displayAr( persons [], int count ) //function to sort arrays//
{
int i;
double overallAvg;
cout << "Student ID Program Average Test Average Overall Average\n";
cout << "-------------------------------------------------------------------\n";
for (i = 0; i < count; i++)
{
overallAvg = (student[i].programAvg * 0.4 ) + ( student[i].testAvg * 0.6 ); //equation for overall average
persons student[MAXSIZE];
int buildAr( persons []);
buildAr (persons);
You declare an array of persons called student, define a function that takes an array of persons, but line 3 isn't giving them an array, you put in a data type, not a variable.
thank you so much, that fixed that problem, but now when I run the program it seems to go in a endless loop and my program crashes, do you have any idea what may be causing this? Also the numbers that were displayed makes no sense, there are a bunch of zeros and alot of exponents.