Mar 15, 2011 at 2:22am UTC
Why can I not write like this? Error keep on appearing on line 9.
1 void student::writeLongRecord()
2 ofstream("student_data.txt");
3 fstream stu;
4 int i=0;
5
6 student.open("student_data.txt",ios::in|ios::out);
7 do{
8 i=i+1;
9 stu << i << " " << student::getRegNo() << " " << fixed << setprecision(1) << student::getAssignmentMark << endl;
10 }
Mar 15, 2011 at 7:29am UTC
You appear to be missing { } on your function.
You are also not opening your fstreams correctly, go re-read the documentation or your tutorial on them.
Error messages would help though.
Mar 15, 2011 at 2:05pm UTC
thanks for pointing that out :) I have solve my problem.