syntax error for classes and pass

if its possible to write classes without any syntax errotror 52


#include<iostream>
#include "Coursee.h"
#include <cstdlib>
using namespace std;

double Course:: Average (Student a[], int num, char k )
{
int i=0;
double sum=0;
if (k=='m')
{
while (i<num)
{
sum = sum + a[i].midterm_exam;
i=i+1;
}
}
else if (k=='f')
{
while (i<num)
{
sum = sum + a[i].final_exam;
i=i+1;
}
}
else
{
while (i<num)
{
sum = sum + a[i].final_grade;
i=i+1;
}
}
double avg=0;
avg= sum/num;
return avg;
}

int Course::firstStudent (Student a[],int num)
{
int i=0;
int idx=0;
double maxgrade=0;
while (i<num)
{

if(a[i].final_exam > maxgrade)
{
maxgrade= a[i].final_exam;
idx=i;
}
i=i+1;
}
return idx;
}


int Course::lastStudent (Student a[],int num)
{
int i=0;
int idx=0;
double mingrade=10;
while (i<num)
{
if(a[i].final_exam < mingrade)
{
mingrade= a[i].final_exam;
idx=i;
}
i=i+1;
}
return idx;
}

void Course:: print_final_grade_statistics()
{
int t=0;
while (t<n_students)
{
cout<<"Final grades of Student whose ID's: "<<students[t].ID<<" is";
cout<<students[t].final_grade<<endl;
t=t+1;
}
cout<<endl<<endl;
int r= firstStudent(students, n_students);
cout<<"The first student is: "<<students[r].ID<<endl;
cout<<"His score is: "<<students[r].final_grade<<endl;

int n= lastStudent (students, n_students);
cout<<"The last student is: "<<students[n].ID<<endl;
cout<<"His score is: "<<students[n].final_grade<<endl;
}

int main()
{
int nstudents = 100;
Student *my_students = new Student[nstudents];
int i =0;
int IDbase = 20130000;
while(i<100)
{
int tmpID = IDbase+i;
double tmpMidterm = 100.0*((rand()+0.0)/(RAND_MAX+0.0));
double tmpFinal = 100.0*((rand()+0.0)/(RAND_MAX+0.0));
Student tmp(tmpID,tmpMidterm,tmpFinal);
my_students[i] = tmp;
i = i + 1;
}

Course EECE230(my_students,nstudents);
EECE230.print_final_grade_statistics();

}
Last edited on
Topic archived. No new replies allowed.