//************************************************* // REGIST.CPP - Course and Registration class // implementations, and main program. //************************************************* #include "course.h" Course::Course() { name[0] = '\0'; } void Course::Input( ifstream & infile ) { infile >> name >> section >> credits; } void Course::Output( ofstream & ofile ) const { ofile << " Course: " << name << '\n' << " Section: " << section << '\n' << " Credits: " << credits << endl; } Registration::Registration() { count = 0; } void Registration::Input( ifstream & infile ) { infile >> studentId >> semester >> count; for(int i = 0; i < count; i++) courses[i].Input( infile ); } void Registration::Output( ofstream & ofile ) const { ofile << "Student ID: " << studentId << '\n' << "Semester: " << semester << '\n'; for(int i = 0; i < count; i++) { courses[i].Output( ofile ); ofile << '\n'; } }