break not working or code error
May 23, 2012 at 2:42am May 23, 2012 at 2:42am UTC
So I have code to push back in to a vector, but before it pushes back it is supposed to check if parts of the vector match and then perform a replace if they do.
Function
1 2 3 4 5 6 7 8 9 10 11
void Database::savestudentgrade(Grades g1){
for (int i=0; i<grades.size(); i=i+1){
Grades g2;
g2=grades[i];
if (g2==g1){
replace (grades.begin(), grades.end(), g2,g1);
break ;
}
}
grades.push_back(g1);
}
CMD PROMPT
1 2 3 4 5
>>save-student-grade
>>gradesoriginal
>>save-student-grade
>>gradesnew
When I check output it contains
Any ideas?
May 23, 2012 at 5:13am May 23, 2012 at 5:13am UTC
Topic archived. No new replies allowed.