Classes I/O

Pages: 12
Did they say specifically no stdio.h?

All well... take a look at both of them side by side and try to see how many similarities you can find. Maybe that will help.
http://cplusplus.com/reference/clibrary/cstdio/
http://cplusplus.com/reference/iostream/ifstream/

I'm falling asleep here... maybe I'll edit this post later.

-Albatross

I see here that you insist on not having some (newline perhaps) character to separate the elements of the data you write in the file... How do you expect do read them properly afterwards?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void Undergrad::write_to_file(ofstream& fout)
{
    
fout.open("Undergrad.txt", ios::app);
fout<< getfname()<< getlname()<< getid()<< getgpa() << getlvl()<< gethousing()<< getfees() << endl;
fout.close();      
}    

void grad::write_to_file(ofstream& fout)
{
fout.open("grad.txt", ios::app);
fout << getfname()<< getlname()<< getid()<< gethours()<< getfees()<< getTA()<< getTT()<< endl;
fout.close();
}
Topic archived. No new replies allowed.
Pages: 12