ok so i got my class to work now im having confusing errors with this:
the errors are
1>h:\cs 215\program 2\program 2\program 2.cpp(79) : error C2059: syntax error : '['
1>h:\cs 215\program 2\program 2\program 2.cpp(80) : error C2143: syntax error : missing ';' before '{'
i dont know what the problem with my synatx could be.
and my compareTo function is:
Code:
void sort(Student stu[], int parameter, int count)
{
Student temp;
bool finished = false;
while (!finished)
{
finished = true;
for (int i = 0; i< count-1; i++)
{
[79] if(Student[i].compareTo(Student[i+1], parameter) == true)
[80] {
temp = stu[i];
stu[i] = stu[i+1];
stu[i+1] = temp;
finished = false;
}
}
}
}
1>h:\cs 215\program 2\program 2\program 2.cpp(79) : error C2059: syntax error : '['
1>h:\cs 215\program 2\program 2\program 2.cpp(80) : error C2143: syntax error : missing ';' before '{'
i dont know what the problem with my synatx could be.
and my compareTo function is:
Code:
bool Student::compareTo (Student stu2, int parameter)
{
if (parameter ==1)
{
if(FirstName < stu2.FirstName)
return false;
else
return true;
}
if (parameter ==2)
{
if(LastName < stu2.LastName)
return false;
else
return true;
}
if (parameter ==3)
{
if(GPA < stu2.GPA)
return false;
else
return true;
}
if (parameter ==4)
{
if(age < stu2.age)
return false;
else
return true;
}
}
Comment