-842150451 -842150451 Cmp-1212 Computer-Logics 1 1 Cmp-1212 Computer-Logics 3 3 Cmp-1212 Computer-Logics 4 5 Cmp-1212 Computer-Logics 5 6
3 replies to this topic
#1
Posted 06 March 2011 - 08:34 AM
I am writing contents to file but for the first record its writing like memory addresses or something, any idea what the problem.
|
|
|
#2
Posted 06 March 2011 - 09:01 AM
#3
Posted 06 March 2011 - 09:14 AM
courselink *position;
position = new courselink();
position->nextcourselink = head;
head = position;
fstream file2;
file2.open("sortbycredit.txt", ios::out);
while (position->nextcourselink !=NULL )
{
file2 << position->getcoursecode() << " " << position->getcoursename() << " " << position->getcourselevel() << " " << position->getcoursecredit() << endl;
position = position->nextcourselink;
}
head = head->nextcourselink;
file2.close();
#4
Posted 06 March 2011 - 09:39 AM
I'm guessing by the spacings in the output that the offending numbers were outputted by the position->getcourselevel() and position->getcoursecredit() methods. I would check to make sure your first list item was initialized correctly.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









