Printing out Array Of Class[StillNEEDANSwER]

Why isn't my array of class cout<<ary[1].getname()<<endl; printing out correctly in c++?
What I would like to do is take information from a student file containing Name/id and assignment scores then calculate their final grade and assigning them a letter grade. I chose the method of printing out their ary element.
Here is my code so far:
Class StudentClass
{

public:

void setname(string x)
{
x=namep;
}
string getname()
{
return namep;
}
void setid(double y)
{
y=idp;
}
double getid()
{
return idp;
}

private:

string namep;
double idp;
double classgrade;
char lettergrade;

};


int main()
{

string name;
double id;
fstream file;
string filename;
StudentClass ary[100];
int i;


cout<<"Enter an input file: ";
cin>>filename;
file.open(filename); //File opened

while(!file.eof())
{


double q1, q2, q3, q4, q5, m1, m2, fin;
double quizgrade,midtermgrade,finalexamgrade,cl...

file>> name >> id >> q1 >> q2 >> q3 >> q4 >> q5 >> m1 >> m2 >> fin;
cout << "Have read in " << name << "'s student information\n"; //temporary, delete later
ary[i].setname(name);





quizgrade=((q1+q2+q3+q4+q5-(min(min(min(... min quiz and dropping

midtermgrade=(m1+m2)/200*100*0.40/40*100... //Grade calculation algorithms

finalexamgrade=fin/100*100*0.40/40*100;

classgrade=quizgrade+midtermgrade+finale...






i++;
}
cout<<ary[1].getname()<<endl;
Last edited on
I believe it's because you didn't name the class, at the top, I only see curly braces. I hope this helped.
Sorry! Left that part out;Just included it; but this is the updated code ^^^ still does not work.
You are missing a lot of pre-processor directives. Remember to do #include to include them in your file.
Topic archived. No new replies allowed.