Expand|Select|Wrap|Line Numbers
- 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:
Expand|Select|Wrap|Line Numbers
- 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;
- }
- }