help me please

this is a code

include <iostream>
include <string>

using namespace std;
class Student
{
private :
int StudentID ;
string FirstName;
string LastName;
string CourseName;
double FirstExamGrade;
double SecondExamGrade;
double AssignmentsGrades [5];
double FinalExamGrade ;
double Avr_Of_Assignment;
double TotalGrade;

public :

void SetFirstName (string S1);
void SetLastName (string  S2);
void SetCourseName (string S3);
string GetFirstName();
string GetLastName();
string GetCourseName();
void SetFirstExam( double F_Grade);
void SetSecondExam(double S_Grade);
void SetFinalExamGrade(double FinalGrade);
void FindAssAverage ();
void FindTotalGrade ();
double GetFinalGrade();
double GetTotalGrade ();

};
void Student::SetFirstName(string S1)
{
FirstName=S1;}
void Student::SetLastName(string S2)
{
LastName=S2;}
void Student::SetCourseName(string S3)
{
CourseName=S3;}
string Student::GetFirstName()
{return FirstName;}
string Student::GetLastName()
{return LastName;}
string Student::GetCourseName()
{return CourseName;}
void Student :: FindAssAverage()
{
double sum =0;
double num =5;
for (int i=0; i<5; i++)
{
cout << " Please insert grade of assinment " << i+1 << endl;
cin >> AssignmentsGrades [i];
if ( AssignmentsGrades [i] >10 && AssignmentsGrades [i]<0)
AssignmentsGrades [i]=0;
sum = sum +AssignmentsGrades [i];
}
Avr_Of_Assignment = sum / num ;

}
void Student:: SetFirstExam(double F_Grade)
{
FirstExamGrade= F_Grade ;

}
void Student ::SetSecondExam(double S_Grade)
{
SecondExamGrade=S_Grade ;
}
void Student ::SetFinalExamGrade(double FinalGrade)
{

FinalExamGrade=FinalGrade ;

}
void Student ::FindTotalGrade ()
{
TotalGrade = FirstExamGrade + SecondExamGrade+ Avr_Of_Assignment;
cout << TotalGrade << endl;
}
double Student ::GetFinalGrade()
{
return FinalExamGrade ;
}
double Student::GetTotalGrade ()
{
return TotalGrade ;
}
double MinTotal (Student A[] );

double MaxTotal (Student A[]);
double Avr_Of_Total(Student A[] );

void main ()
{

Student A[3];
string firstname ;
string lastname;
string coursename;
double AvrOfAssignment;
double  FirstExamGrade ;
double SecondExamGrade;
double FinalGrade;
double Total_Grade ;
double MinTotal ;
double MaxTotal;
double Avr_Of_Total;
cout << " Please Insert : \n" ; 

for ( int i=0 ; i<3 ; i++  )

{   cout << "Student number " << i+1 << endl;
    cout<<"1)First Name : "; cin>> firstname;
   cout << "\n2)Last Name : " ; cin >> lastname;
   cout << "\n3)Course Name : " ; cin >> coursename;
   cout << endl;
   A[i].SetFirstName (firstname);
   A[i].SetLastName(lastname);
   A[i].SetCourseName(coursename);
        cout << "Student Name: "<< A[i].GetFirstName()<< " "<< A[i].GetLastName()<<endl;
        cout << "Course Name: " << A[i].GetCourseName ()<<endl << endl; 
        cout << "  First exam grade : " ; cin >> FirstExamGrade ;
        cout << "  Second exam grade: " ;cin >> SecondExamGrade;
        A[i].FindAssAverage ();

        A[i].SetFirstExam( FirstExamGrade);
        A[i].SetSecondExam(SecondExamGrade);
        A[i].FindTotalGrade ();
        cout << "Final exam grade: " ; cin >> FinalGrade ;
        A[i].SetFinalExamGrade(FinalGrade);
        Total_Grade = A[i].GetFinalGrade()+ A[i].GetTotalGrade();
        cout << Total_Grade <<endl;
    }


cout << MinTotal(A)<<endl;
cout << MaxTotal(A)<<endl;
cout << Avr_Of_Total(A)<< endl;

}
double MinTotal (Student A[])
{ int x =3 ;
double Min = A[0].GetFinalGrade()+ A[0].GetTotalGrade();

for (int j=0;j<x;j++ )
{
    if( A[j].GetFinalGrade()+ A[j].GetTotalGrade()<Min )
        Min= A[j].GetFinalGrade()+ A[j].GetTotalGrade();
    return Min ;

}}
double MaxTotal (Student A[]) 

{ int x=3;
double Max = A[0].GetFinalGrade()+ A[0].GetTotalGrade();
for ( int j=0;j<x;j++)
{

    if( A[j].GetFinalGrade()+ A[j].GetTotalGrade()>Max )
        Max= A[j].GetFinalGrade()+ A[j].GetTotalGrade();
    return Max ;

}}
 double Avr_Of_Total(Student A[])
{   int x=3 ;
    double sum=0;
    double Avr ;
for ( int j=0;j<x;j++)
{
    sum =sum+ A[j].GetFinalGrade()+ A[j].GetTotalGrade();

}
Avr=sum/3;
return Avr;
}

Recommended Answers

All 5 Replies

The problem is in these lines:
MinTotal, MaxTotal & Avr_Of_Total are declare as doubles, but you are using these as fuctions.

cout << MinTotal(A)<<endl;
cout << MaxTotal(A)<<endl;
cout << Avr_Of_Total(A)<< endl;

Cheers Milton

Thank you
but What can I do ?
how to solve this problem ?

I'm still beginner in c++

In your main you have declare MinTotal, MaxTotal & Avr_Of_Total
as variables of type double, but later in main you have also declared them as fuctions.
As these fuction are declared later the compliler will treat them as variables of type double and not the functions you intend to use.
You should remove the variable declarations in lines 10, 11 and 12.
Comment the lines out and try that.
Cheers Milton

Oh .. Yes Yes
Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.