bool InsertResult(char *filename, List<Student> *list)
{
ifstream infile;
List<Exam> exm;
List<Subject> subj;
string tmp;
int size;
char trimester[4],id[10],temp[10],temp1[10];
Subject sub;
infile.open("exam.txt");
if(!infile)
{
cout<<"File is not exist!!";
system("pause");exit(1);
}
while(!infile.eof())
{
Exam x;
Student s1;
infile>>x.stdid>>x.trimester>>x.year>>x.numOfSubjects;
cout<<x.stdid<<" "<<x.trimester<<" "<<x.year<<" "<<x.numOfSubjects<<endl;;
for(int i=1; i<=x.numOfSubjects; i++)
{
infile >> x.sub[i].subject_code>>x.sub[i].subject_name
>>x.sub[i].credit_hours>>x.sub[i].marks;
}
for(int k=1;k<=list->size();k++)
{
list->get(k,s1);
//strcpy(temp,list->find(s1)->item.id);
if(strcmp(x.stdid,s1.id)==0)
{
int size = list->find(s1)->item.exam->size();
//list->find(s1)->item.exam->insert(size+1,x);
list->find(s1)->item.exam
list->find(s1)->item.calculateCurrentCGPA();
/*stu.exam->insert(stu.exam->size()+1,exm);
list->set(b, stu);*/
break;
}
}
}
infile.close();
}
help will be appreciate..
cant upload all the header and cpp here its too long