I am slow when it comes to understanding c++ and I don't understand the errors it gives

I don't have much time, so please help me

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
// add other includes if needed


//--------- class header - DO NOT MODIFY --------------//
class Student
{
public:
    Student();
    Student(int initID, string initFirst, string initLast);
    void SetID(int newID);
    void SetFirstName(string F);
    void SetLastName(string L);
    void SetFullName(string F, string L);
    bool ReadScores(istream& in);  // input stream open & ready to read grades
    bool ReadData(istream& in);  // input stream open & ready to read full record
    int GetID() const;
    string GetFirstName() const;
    string GetLastName() const;
    string GetFullName() const;
    string NameSortsAs() const;
    float AvgHomework() const;
    float AvgExam() const;
    float WeightedAvg() const;
    string LetterGrade() const;
private:
    string first, last;
    int homework[10];
    int exam[3];
    int ID;
};
//-------- end class header -----------------------------//

// Global consts (if any) go here

// Your function declarations, prototypes, etc., go here.

// Your main function goes here.
void process();
void sort();
void newgrade();

Student Data;

int main()
{
    process();
return 0;
}

void process()
{
ifstream in;        //declare variables.
ofstream out;
int ID, initID;
string F, L, initFirst, initLast;

good = false;

in.open("grade.txt");     //open inputfile.

if (!in)        //if it doesn't open.
{
Student();      //data is set to 0.
Student(initID, initFirst, initLast);     //and all the other process comes along.
}
else

while (in)      //while reading the file.
{
Data.ReadData(in);       //read ID, 1st + last name
Data.SetID(ID);      //set the ID.
Data.SetFirstName(F);        //set the first name.
Data.SetLastName(L);     //set the last name.
Data.ReadScores();     //read hw scores and exam scores
}

in.close("grade.txt");      //close the input file.

out.open("name.txt");       //open outputfile for sorted data.

out << sort();

out.close("name.txt");      //close the outputfile.

out.open ("newgrade.txt");      //open outputfile for newgraded data.

out << newgrade();      //send data to file.

out.close("newgrade.txt");      //close the data file.

}
// Your function bodies go here.
void sort()
{
    string L;
    for (int a = 1; a < 104; a++)
    {
    for (int b= 1; b < 103 - a; b++)
{
    if (Data[b].SetLastName(L) > Data[b+1].SetLastName(L))
    swap (Data[b].SetLastName(L) ,  Data[b+1].SetLastName(L));

}
    }
Data.GetID();
Data.GetFirstName();
Data.GetLastName();
Data.GetFullName();
Data.NameSortAs();
Data.WeightedAvg();
Data.LetterGrade();
}

void newgrade()
{
    for (int a = 1; a < 104; a++)
    {
        for (int b= 1; b < 103 -a; b++)
        {
            if (Data[b].WeightedAvg() < Data[b + 1].WeightedAvg())
            swap (Data[b].WeightedAvg() , Data[b + 1].WeightedAvg());
        }
    }

Data.GetID();
Data.GetFirstName();
Data.GetLastName();
Data.GetFullName();
Data.NameSortsAs();
Data.WeightedAvg();
Data.LetterGrade();

}
//------ class implementation -- DO NOT MODIFY ANY CODE BELOW THIS LINE.----//

Student::Student()      //if file is empty, everything is filled out with 0's.
{
    for (int k = 0; k < 10; k++)
        homework[k] = 0;
    for (int k = 0; k < 3; k++)
        exam[k] = 0;
    ID = 0;
}

Student::Student(int initID, string initFirst, string initLast)
{
    Student();
    SetID(initID);
    SetFirstName(initFirst);
    SetLastName(initLast);
}

void Student::SetID(int newID)
{
    if (newID >= 100)
        ID = newID;
}

void Student::SetFirstName(string F)
{
    first = F;
}

void Student::SetLastName(string L)
{
    last = L;
}

void Student::SetFullName(string F, string L)
{
    SetFirstName(F);
    SetLastName(L);
}

bool Student::ReadScores(istream& in)
{
    for (int k = 0; k < 10; k++)
        in >> homework[k];
    for (int k = 0; k < 3; k++)
        in >> exam[k];
    return in.good();
}

bool Student::ReadData(istream& in)
{
    string tmp;
    int tmpInt;

    in >> tmpInt;
    SetID(tmpInt);
    in >> tmp;
    SetFirstName(tmp);
    in >> tmp;
    SetLastName(tmp);
    return ReadScores(in);
}

int Student::GetID() const
{
    return ID;
}

string Student::GetFirstName() const
{
    return first;
}

string Student::GetLastName() const
{
    return last;
}

string Student::GetFullName() const
{
    return (first + ' ' + last);
}

string Student::NameSortsAs() const
{
    string tmp = last + ' ' + first;
    for (int k = 0; k < tmp.length(); k++)
        tmp[k] = tolower(tmp[k]);
    return tmp;
}

float Student::AvgHomework() const
{
    int total = 0;
    for (int k = 0; k < 10; k++)
        total += homework[k];
    return (total/10.0f);
}

float Student::AvgExam()const
{
    int total = 0;
    for (int k = 0; k < 3; k++)
        total += exam[k];
    return (total/3.0f);
}

float Student::WeightedAvg()const
{
    float Exams = AvgExam();
    float Homeworks = AvgHomework();
    Homeworks *= 2; // convert from 50-pt scale to 100-pt scale
    return ( (Homeworks*0.6f) + (Exams * 0.4f));
}

string Student::LetterGrade() const
{
    int score;

    score = int( WeightedAvg() + 0.5); // round to nearest integer
    if (score >= 93)
        return "A";
    else if (score >= 90)
        return "A-";
    else if (score >= 88)
        return "B+";
    else if (score >= 83)
        return "B";
    else if (score >= 80)
        return "B-";
    else if (score >= 78)
        return "C+";
    else if (score >= 73)
        return "C";
    else if (score >= 70)
        return "C-";
    else if (score >= 68)
        return "D+";
    else if (score >= 63)
        return "D";
    else if (score >= 60)
        return "D-";
    else
        return "F";
}

How can we help you if we don't know which errors you are getting?

Also please use [code]

[/code] tags around your code.

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.