ok here is the driver file but im gettin these weird syntax error
Code:
#include "lab1InstructorCL.cpp"
void printCourses(Instructor *);
void printData(Instructor *[]);
void printSpaces(int num_spaces_to_print);
void printInstructor(Instructor *);
void readCourses(ifstream &I, Instructor *[]);
void readData(ifstream &, Instructor *[]);
int main()
{
cout << "This is line number " << __LINE__ << " of the file " <<
__FILE__
<< " which was\ncompiled on " << __DATE__ << " at time " <<
__TIME__
<< ".\n";
ifstream inFile("input.dat", ios::in);
if(!inFile)
{
cerr << "Could not open the file "
<< "for input.\n";
exit(ABNORMAL_EXIT);
}
else
cout << "The file input.dat is open for
input.\n\n";
Instructor *S[MAX_INSTRUCTORS] = {NULL_POINTER};
readData(inFile, S);
cout << "\n\nThe instructors hired at XYZ are:\n\n";
//printData(S);
//readCourses(inFile, S);
cout << "\n\nThe XYZ instructors and their teaching assignments
are:\n\n";
//printData(S);
cout << "The retirement ceremony has begun:\n\n";
for(int index = LOOP_BASE; index < MAX_INSTRUCTORS; index++)
{
delete S[index];
S[index] = NULL_POINTER;
}
}
/******************************************************************************
FUNCTION NAME : printCourses
CLASS : (global)
QUALIFIERS : none
INPUTS : a non-consant pointer to a non-constant object of
class
Instructor
RETURNS : nothing
PURPOSE : print the courses taught by this instructor, to the
screen,
in columnar format
******************************************************************************/
/******************************************************************************
FUNCTION NAME : printData
CLASS : (global)
QUALIFIERS : none
INPUTS : a nonconstant array of pointers to nonconstant objects
of
class Instructor
RETURNS : nothing
PURPOSE : for every non-null pointer in the incoming argument,
pass
pointer to printInstructor().
******************************************************************************/
void printData(Instructor *S[])
{
for(int index = LOOP_BASE; index < MAX_INSTRUCTORS; index++)
{
if(S[index] != NULL_POINTER)
printInstructor(S[index]);
}
}
/******************************************************************************
FUNCTION NAME : printSpaces
CLASS : global
QUALIFIERS : none
INPUTS : an integer
RETURNS : nothing
PURPOSE : print to the screen a number of blank spaces equal to
the
value of the incoming argument
******************************************************************************/
void printSpaces(int num_spaces_to_print)
{
for(int index = LOOP_BASE; index < num_spaces_to_print; index++)
{
cout << ' ';
}
}
/******************************************************************************
FUNCTION NAME : printInstructor
CLASS : global
QUALIFIERS : none
INPUTS : a non-constant pointer to a non-constant object of
class
Insructor
RETURNS : nothing
PURPOSE : print to the screen the data concerning this
instructor,
in columnar format, using the printCourses() function
as appropriate
******************************************************************************/
void printInstructor(Instructor *S)
{
cout << "Instructor " << S->getLastName() << ',';
printSpaces(LAST_NAME_FIELD_WIDTH - S->getLastName().length());
cout << S->getFirstName();
printSpaces(FIRST_NAME_FIELD_WIDTH - S->getFirstName().length());
cout << ' ' << S->getMiddleInitial()
<< ' ' << S->getEmployeeID();
if(S->Courses[INDEX_BASE].courseDepartment.size() !=
EMPTY_STRING_SIZE)
{
printCourses(S);
}
else
cout << '\n';
}
/******************************************************************************
FUNCTION NAME : readCourses
CLASS : none
QUALIFIERS : none
INPUTS : an ifstream object, by reference using a reference
parameter
an array of non-constant pointers to non-constant
objects of
class Instructor
RETURNS : nothing
PURPOSE : for all instructors pointed to by the second argument,
read
from the stream referred to by the first argument the
courses to be taught by that instructor and store
those
values in the appopriate fields in the object
******************************************************************************/
void readCourses(ifstream &I, Instructor *S[])
{
string courseDepartment;
int numStudents;
string courseNumber;
string employeeID;
while(!I.eof())
{
I >> employeeID >> courseDepartment >> courseNumber >> numStudents;
if(I.eof())
break;
for(int instructorIndex = LOOP_BASE;
instructorIndex < MAX_INSTRUCTORS;
instructorIndex++)
{
if(S[instructorIndex]->getEmployeeID() == employeeID)
{
for(int courseIndex = LOOP_BASE;
courseIndex < MAX_COURSES;
courseIndex++)
{
if(S[instructorIndex]->Courses[courseIndex].courseDepartment.size() ==
EMPTY_STRING_SIZE)
{
S[instructorIndex]->Courses[courseIndex].courseDepartment =
courseDepartment;
S[instructorIndex]->Courses[courseIndex].courseNumber =
courseNumber;
S[instructorIndex]->Courses[courseIndex].numStudents =
numStudents;
break;
}
}
}
}
}
}
/******************************************************************************
FUNCTION NAME : readData
CLASS : none
QUALIFIERS : none
INPUTS : a reference to an ifstream object
an array of non-constant pointers to non-constant
objects of
class Instructor
RETURNS : nothing
PURPOSE : read from the stream referred to by the first argument
the
values necessary to instantiate an Instructor object
instantiate the Instructor object with those values
and
assign the address of the object to the next
available
pointer in the second argument
******************************************************************************/
void readData(ifstream &I, Instructor *S[])
{
string firstName;
string lastName;
string middleInitial;
string employeeID;
string bmn; // Birth Month
string bdy; // Birth Day
string byr // Birth Year
string hmn; // Hire Month
string hdy; // Hire Day
string hyr; // Hire Year
for(int index = 0; index < 3; index++)
{
inFile >> firstName >> middleInitial >> lastName >> employeeID>>bmn
>>bdy>>byr>>hmn>>hdy>>hyr;
S[index] = new Instructor(firstName, lastName, middleInitial,
employeeID);
}
}
Compiling...
lab1Driver.cpp
c:\documents and settings\massa\lab1instructorcl.cpp(9) : error C2629: unexpected 'class Instructor ('
c:\documents and settings\massa\lab1instructorcl.cpp(9) : error C2238: unexpected token(s) preceding ';'
c:\documents and settings\massa\lab1instructorcl.cpp(17) : error C2146: syntax error : missing ';' before identifier 'getFirstName'
c:\documents and settings\massa\lab1instructorcl.cpp(17) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(18) : error C2146: syntax error : missing ';' before identifier 'getLastName'
c:\documents and settings\massa\lab1instructorcl.cpp(18) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(19) : error C2146: syntax error : missing ';' before identifier 'getMiddleInitial'
c:\documents and settings\massa\lab1instructorcl.cpp(19) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(20) : error C2146: syntax error : missing ';' before identifier 'getEmployeeID'
c:\documents and settings\massa\lab1instructorcl.cpp(20) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(22) : error C2061: syntax error : identifier 'string'
c:\documents and settings\massa\lab1instructorcl.cpp(23) : error C2061: syntax error : identifier 'string'
c:\documents and settings\massa\lab1instructorcl.cpp(24) : error C2061: syntax error : identifier 'string'
c:\documents and settings\massa\lab1instructorcl.cpp(25) : error C2061: syntax error : identifier 'string'
c:\documents and settings\massa\lab1instructorcl.cpp(29) : error C2146: syntax error : missing ';' before identifier 'firstName'
c:\documents and settings\massa\lab1instructorcl.cpp(29) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(29) : error C2501: 'firstName' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(30) : error C2146: syntax error : missing ';' before identifier 'lastName'
c:\documents and settings\massa\lab1instructorcl.cpp(30) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(30) : error C2501: 'lastName' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(31) : error C2146: syntax error : missing ';' before identifier 'middleInitial'
c:\documents and settings\massa\lab1instructorcl.cpp(31) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(31) : error C2501: 'middleInitial' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(32) : error C2146: syntax error : missing ';' before identifier 'employeeID'
c:\documents and settings\massa\lab1instructorcl.cpp(32) : error C2501: 'string' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(32) : error C2501: 'employeeID' : missing storage-class or type specifiers
c:\documents and settings\massa\lab1instructorcl.cpp(37) : fatal error C1020: unexpected #endif
Error executing cl.exe.
lab1Driver.exe - 27 error(s), 0 warning(s)