these are the errors that i'm getting
i dont' know whats wrong because most of it is given by the instructor
any help with these errors will be greatly appreciated

c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(12) : error C2236: unexpected 'class' 'Queue'. Did you forget a ';'?
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(12) : error C2143: syntax error : missing ';' before '{'
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(12) : error C2447: '{' : missing function header (old-style formal list?)
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(62) : error C2504: 'Personnel' : base class undefined
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(64) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(64) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(64) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(68) : error C2236: unexpected 'class' 'Contact'. Did you forget a ';'?
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(68) : error C2143: syntax error : missing ';' before '{'
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(68) : error C2447: '{' : missing function header (old-style formal list?)
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(94) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(94) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(94) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(102) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(102) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(102) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(102) : warning C4183: 'getContact': missing return type; assumed to be a member function returning 'int'
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(102) : error C2065: 'pContact' : undeclared identifier
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(108) : error C2227: left of '->getAddress' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(109) : error C2227: left of '->getPhone' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(110) : error C2227: left of '->getEmail' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(119) : error C2061: syntax error : identifier 'Contact'
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(123) : error C2541: 'delete' : cannot delete objects that are not pointers
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(159) : error C2541: 'delete' : cannot delete objects that are not pointers
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(185) : error C2541: 'delete' : cannot delete objects that are not pointers
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\book.cpp(237) : error C2541: 'delete' : cannot delete objects that are not pointers

Code:

#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
using namespace std;
class Contact {
private:    
        char cAddress[75];
        char cPhone[25];
        char cEmail[75];
public:
        void setAddress(char *cAddress) {strcpy(this->cAddress, cAddress);} 
        void setPhone(char *cPhone) { strcpy(this->cPhone, cPhone); }
        void setEmail(char *cEmail) { strcpy(this->cEmail, cEmail); }
        char* getAddress() { return cAddress; }
        char* getPhone() { return cPhone; }
        char* getEmail() { return cEmail; }

        Contact(char *cAddress, char *cPhone, char *cEmail) { // constructor
            setAddress(cAddress);
            setPhone(cPhone);
            setEmail(cEmail);
        }
};

class Personnel {
    private:
        char cName[50];
        int iId;
        char cBirthday[11];
    protected:
        Contact *pContact;
    public: 
        void setName(char *cName) { strcpy(this->cName, cName); }
        void setBirthday(char *cBirthday) {strcpy(this->cBirthday, cBirthday);}
        void setId(int iId) { this->iId = iId; }
        char* getName() { return cName; }
        int getId() { return iId;}
        char* getBirthday() { return cBirthday; }
        Contact * getContact() { return pContact; }
        virtual void display() {
            cout << "PERSONNEL" << endl;        
            cout << "Name:\t" << getName() << endl;
            cout << "Id:\t" << getId() << endl;
            cout << "Birthday:\t" << getBirthday() << endl;
            cout << "Address:\t" << pContact->getAddress() << endl;
            cout << "Phone:\t" << pContact->getPhone() << endl;
            cout << "Email:\t" << pContact->getEmail() << endl;
        }

        Personnel(char *cName, char *cBirthday, char *cAddress, char *cPhone, char *cEmail) {                   // constructor
            static int iIdCounter = 0;
            setName(cName);     // set Name
            setId(iIdCounter);  // set Id by a self-incremental counter
            iIdCounter++;       // increment the ID generator;
            setBirthday(cBirthday); // set Birthday
            pContact = new Contact(cAddress, cPhone, cEmail);
        }

        virtual ~Personnel() {              // destructor
            delete pContact;        // delete the object linked to pContact
            pContact = NULL;        // Make sure pContact not point to an object
        }                           
};

class Employee : public Personnel    {  // inherit from Personnel
    private:
        char cDepartment[75];
        float fSalary;
        char cRank[75];

    public:
        void setDepartment(char *cDepartment) {strcpy(this->cDepartment, cDepartment);}
        void setSalary(float fSalary) { this->fSalary = fSalary; }
        virtual void setRank(char *cRank) { strcpy(this->cRank, cRank); }
        char* getDepartment() { return cDepartment; }
        float getSalary() { return fSalary; }
        virtual char* getRank() { return cRank; }

        void display() {
            Personnel::display();
            cout << "EMPLOYEE" << endl; 
            cout << "Department:\t" << getDepartment() << endl;
            cout << "Salary:\t" << getSalary() << endl;
            cout << "Rank:\t" << getRank() << endl;
        }

        Employee(char *cName, char *cBirthday, char *cAddress, char *cPhone, char *cEmail, char *cDepartment, float fSalary, char *cRank) 
            : Personnel(cName, cBirthday, cAddress, cPhone, cEmail) 
        {
            setDepartment(cDepartment);
            setSalary(fSalary);
            setRank(cRank);
        }

        virtual ~Employee() {               // destructor
            delete pContact;        // delete the object linked to pContact
            pContact = NULL;        // Make sure pContact does not point to 
        }                       // any object
};

class Faculty : public Employee {   // inherit from Employee
    private:    
        char cResearch[75];
    public:
        virtual void setResearch(char *cResearch) {
            strcpy(this->cResearch, cResearch);
        }
        char* getResearch() { return cResearch; }
        virtual void display() {
            Employee::display();
            cout << "FACULTY" << endl;
            cout << "Research\t" << getResearch() << endl;
        }

        Faculty(char *cName, char *cBirthday, char *cAddress, char *cPhone, char *cEmail, char *cDepartment, float fSalary, char *cRank, char *cResearch) 
            : Employee(cName, cBirthday, cAddress, cPhone, cEmail, cDepartment, fSalary, cRank)
        {
            setResearch(cResearch);
        }

        virtual ~Faculty() {                // destructor
            delete pContact;        // delete the object linked to pContact
            pContact = NULL;        // Make sure pContact does not
        }                       // point to any object
};

class ConsultingCo {                // not inherit from a class
private:
    char division[30];
    float wage;
public:
    virtual void display(){
        cout << "ConsultingCo" << endl;
        cout << "Division: " << getDivision() << endl;
        cout << "Wage: " << getWage() << endl;
    }
    char* getDivision(){
        return division;
    }
    void setDivision(char *division_){
        strcpy(this->division, division_);
    }
    float getWage(){
        return wage;
    }
    void setWage(float wage_){
        this->wage = wage_;
    }
    ConsultingCo(char *division_, float wage_) {
        setDivision(division_);
        setWage(wage_);
    }
};

// multiple inheritance: Consultant class inherit from two classes
class Consultant : public Employee, public ConsultingCo{
private:
    int hours;
public:
    virtual void display() {
        Employee::display();
        ConsultingCo::display();
        cout << "Consultant" << endl;
        cout << "Hours: " << getHours() << endl;
    }
    int getHours(){ return hours;}
    void setHours(int hours_) {this->hours = hours_;}
    Consultant(char *cName, char *cBirthday, char *cAddress, char *cPhone, char *cEmail, char *cDepartment, float fSalary, char *cRank, char* division_, float wage_, int hours_) 
            : Employee(cName, cBirthday, cAddress, cPhone, cEmail, cDepartment, fSalary, cRank), ConsultingCo(division_, wage_)
    {
        setHours(hours_);
    }
        virtual ~Consultant() {         // destructor
            delete pContact;        // delete the object linked to pContact
            pContact = NULL;        // Make sure pContact does not point to 
        }                       // any object
};

class PersonnelNode {       // This is a container class
    private:
        Personnel       *pNode; // It contains a Personnel class
        PersonnelNode   *pNext; // pointer used to form a linked list
    public:
        void setNode(Personnel *pNode) { this->pNode = pNode; }
        void setNext(PersonnelNode *pNext) { this->pNext = pNext; }
        Personnel* getNode() { return pNode; }
        PersonnelNode* getNext() { return pNext; }

        PersonnelNode() {       // constructor
            pNode = NULL;
            pNext = NULL;
        }
} *head = NULL; // declare a global pointer variable head

// Forward declaration of global functions outside any class
int main();             // The main function
void menu();            // display main choices
void branching(char);   // branch to the chosen function
void sub_menu();            // display different insertion options
void insert();          // call sub_menu() and branch to chosen function
int insert_personnel(); // insert a personnel node
int insert_employee();  // insert an employee node
int insert_faculty();   // insert a faculty node
int insert_consultant();
void remove();          // call remove function
void display_all();     // display members in all nodes in the linked list
void display_node(Personnel*, int); // display the members in one node

int main() {    // main function is the entry point of the program
    char ch;
    cout << "!!CLASSES INHERITANCE, HIERARCHY AND POLYMORPHISM" << endl;
    cout << "***********************************************" << endl;

    do {
         menu();                // display choices
         cin >> ch;         // enter a choice from the keyboard
         ch = tolower(ch);  // convert to lower case
         branching(ch);     // branch to the chosen function
    }
    while (ch != 'q');          // 'q' for quit
    return 0;
}

void menu() {
    cout <<   endl << endl << "MENU" << endl;
    cout << "----" << endl;
    cout << "i: Insert a new entry." << endl;
    cout << "d: display all entries." << endl;
    cout << "r: remove an entry." << endl;
    cout << "q: Quit the program." << endl;
    cout << endl << "Please enter your choice (i, d, r, or q) --> ";
}

void branching(char c) {        // branch to chosen function
     switch(c) {
        case 'i':   insert();
                break;
        case 'd':   display_all();
                break;
        case 'r':   remove();
                break;
        case 'q':   cout << endl << "@Exiting the program..............." << endl;
                cin.get();  //type any key.
                break;
        default:    cout << endl << "@ERROR - Invalid input." << endl;
                cout << "@Try again....." << endl;
     }
}

void sub_menu() {   // display insertion options
    cout <<   endl << endl << "INSERTION SUB-MENU" << endl;
    cout << "------------------" << endl;
    cout << "p: insert a personnel entry." << endl;
    cout << "e: insert an employee entry." << endl;
    cout << "f: insert a faculty entry." << endl;
    cout << "c: insert a consultant entry." << endl;
    cout << "q: Quit insertion and back to main menu." << endl;
    cout << endl << "Please enter your choice (p, e, f, c, or q) --> ";
}

// insert() is the umbrella insertion function that calls different insertion
// functions according to the selection in the sub-menu.
void insert() {
    char ch;

    cout << endl << "@Insertion module...............";
    do {
         sub_menu();
         cin >> ch;
         ch = tolower(ch);

         switch(ch) {
            case 'p':   if(insert_personnel() != 0)
                            cout << "@INSERTION OPERATION FAILED." << endl;
                        else
                            cout << "@INSERTED SUCCESSFULLY." << endl;
                            break;
            case 'e':   if(insert_employee() != 0)
                            cout << "@INSERTION OPERATION FAILED." << endl;
                        else
                            cout << "@INSERTED SUCCESSFULLY." << endl;
                            break;
            case 'f':   if(insert_faculty() != 0)
                            cout << "@INSERTION OPERATION FAILED." << endl;
                        else
                            cout << "@INSERTED SUCCESSFULLY." << endl;
                            break;
            case 'c':   if(insert_consultant() != 0)
                            cout << "@INSERTION OPERATION FAILED." << endl;
                        else
                            cout << "@INSERTED SUCCESSFULLY." << endl;
                            break;
            case 'q':   cout << endl << "@Exiting the insertion..." << endl;
                        cin.get();
                        break;
            default:        cout << endl << "@ERROR - Invalid input." << endl;
                        cout << "@Try again....." << endl;
        }
    } 
    while (ch != 'q');
}

int insert_personnel() {        // insert a Personnel node
    Personnel *person = NULL;
    PersonnelNode *node = NULL;
    char name[50], birthday[11], address[75], phone[25], email[75];
    cout << endl << "@Inserting personnel node.........." << endl;
    cout << "Enter the name: ";
    cin.ignore();   // fflush()
    cin.getline(name, 50);
    cout << "Enter the birthday, e.g., 05/24/1985: ";
    cin.getline(birthday, 11);
    cout << "Enter the address: ";
    cin.getline(address, 75);
    cout << "Enter the phone number: ";
    cin.getline(phone, 25);
    cout << "Enter the email: ";
    cin.getline(email, 75);
    person = new Personnel(name, birthday, address, phone, email);
    node = new PersonnelNode();

    if((person != NULL) && (node != NULL)) {
        node->setNode(person);
        node->setNext(head);
        head = node;
        return 0;
    }
    else {
        cout << endl << "@ERROR - Could not allocate enough memory!" << endl;
        return -1;
    }
}

int insert_employee() {     // insert an Employee node
    Personnel *person = NULL;
    PersonnelNode *node = NULL;
    char name[50], birthday[11], address[75], phone[25], email[75], department[75], rank[75];
    float salary;

    cout << endl << "@Inserting employee node.........." << endl;
    cout << "Enter the name: ";
    cin.ignore();
    cin.getline(name, 50);
    cout << "Enter the birthday, e.g., 05/24/1985: ";
    cin.getline(birthday, 11);
    cout << "Enter the address:";
    cin.getline(address, 75);
    cout << "Enter the phone number: ";
    cin.getline(phone, 25);
    cout << "Enter the email: ";
    cin.getline(email, 75);
    cout << "Enter the department: ";
    cin.getline(department, 75);
    cout << "Enter the salary. It must be a float number: ";
    cin >> salary;
    cout << "Enter the rank: ";
    cin.ignore();
    cin.getline(rank, 75);

    person = new Employee(name, birthday, address, phone, email, department, salary, rank);
    node = new PersonnelNode();

    if((person != NULL) && (node != NULL)) {
        node->setNode(person);
        node->setNext(head);
        head = node;
        return 0;
    }
    else {
        cout << endl << "@ERROR - Could not allocate enough memory!" << endl;
        return -1;
    }
}

int insert_faculty() {      // insert a Faculty node
    Personnel *person = NULL;
    PersonnelNode *node = NULL;
    char name[50], birthday[11], address[75], phone[25], email[75], department[75], rank[75], research[75];
    float salary;

    cout << endl << "@Inserting faculty node.........." << endl;
    cout << "Enter the name: ";
    cin.ignore();
    cin.getline(name, 50);
    cout << "Enter the birthday, e.g., 05/24/1985: ";
    cin.getline(birthday, 11);
    cout << "Enter the address: ";
    cin.getline(address, 75);
    cout << "Enter the phone number: ";
    cin.getline(phone, 25);
    cout << "Enter the email: ";
    cin.getline(email, 75);
    cout << "Enter the department: ";
    cin.getline(department, 75);
    cout << "Enter the salary. It must be a float number: ";
    cin >> salary;
    cout << "Enter the rank: ";
    cin.ignore();
    cin.getline(rank, 75);

    cout << "Enter the research: ";
    cin.getline(research, 75);

    person = new Faculty(name, birthday, address, phone, email, department, salary, rank, research);
    node = new PersonnelNode();
    if((person != NULL) && (node != NULL)) {
        node->setNode(person);
        node->setNext(head);
        head = node;
        return 0;
    }
    else {
        cout << endl << "@ERROR - Could not allocate enough memory!" << endl;
        return -1;
    }
}
int insert_consultant() {       // insert a Faculty node
    Personnel *person = NULL;
    PersonnelNode *node = NULL;
    char name[50], birthday[11], address[75], phone[25], email[75], department[75], rank[75], division[30];
    float salary, wage;
    int hours;

    cout << endl << "@Inserting consultant node.........." << endl;
    cout << "Enter the name: ";
    cin.ignore();
    cin.getline(name, 50);
    cout << "Enter the birthday, e.g., 05/24/1985: ";
    cin.getline(birthday, 11);
    cout << "Enter the address: ";
    cin.getline(address, 75);
    cout << "Enter the phone number: ";
    cin.getline(phone, 25);
    cout << "Enter the email: ";
    cin.getline(email, 75);
    cout << "Enter the department: ";
    cin.getline(department, 75);

    cout << "Enter the salary. It must be a float number: ";
    cin >> salary;
    cout << "Enter the rank: ";
    cin.ignore();
    cin.getline(rank, 75);
    cout << "Enter the division: ";
    cin.getline(division, 30);
    cout << "Enter the wage. It must be a float number: ";
    cin >> wage;
    cout << "Enter the hours. It must be an integer: ";
    cin >> hours;

    person = new Consultant(name, birthday, address, phone, email, department, salary, rank, division, wage, hours);
    node = new PersonnelNode();
    if((person != NULL) && (node != NULL)) {
        node->setNode(person);
        node->setNext(head);
        head = node;
        return 0;
    }
    else {
        cout << endl << "@ERROR - Could not allocate enough memory!" << endl;
        return -1;
    }
}

/* void remove() function removes a node in the linked list. In the remove function, an id number will be entered as the key. The node whose id field stored an id number that is equal to the entered id number will be removed. */
void remove() {
     int id;
     PersonnelNode *temp, *prev;
     Personnel *person;
     int index = 1;
     cout<<"Remove module...............\n" << endl ;
     cout<<"Please enter the ID number of the person to be deleted: "<<endl;
     cin>> id; 
     temp = head;
     while (temp != NULL) {
         person = temp->getNode();
            if (id != person->getId()){
                prev = temp;
                temp = temp->getNext();
                index++;
            }
            else {
                cout <<"Person to delete is found at index" << index<<endl;
                display_node(person, index);
                if(temp != head)
                prev->setNext(temp->getNext());
                else
                    head = head->getNext();
                delete person;  // explicit garbage-collection
                person = NULL;  // Make person not to point to any object
                delete temp;        // explicit garbage-collection
                temp = NULL;        // Make temp not to point to any object
                return;
            }
        }
     cout <<"The person with ID = << id << does not exist."<< endl;
}

void display_all() {    // Display contents of all nodes in the linked list
    PersonnelNode *node;
    int node_count= 0;
    cout << endl << "@Display module...............";
    node = head;
    while(node != NULL) {
        display_node(node->getNode(), ++node_count);    
        node = node->getNext();
    }
    cout << endl << "@No more records." << endl;
}

void display_node(Personnel *node, int index) {// Display contents of node
    cout << endl << "Record " << index << "." << endl;
    node->display();// Polymorphic call. Depending on the object pointed to
}               // by node, a different display function will be invoked.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.