The program is all working now, but I'm worried because on the last linked lists assignment I got a C because I did not do the link correctly. My prof said that I did not create the links up correctly just used a stack to get descending in the last assignment. I want to make sure I did not do that this time.

Here's the code, can someone just tell me if I did it correctly.

#include "applicant.cpp"
#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

struct Employeelink
 int id;
 int yearsWorked;
 char skillLevel;
 Applicant item;
 Employeelink *next, *before;

class Promosion
         float value;
         Employeelink *start;
         Employeelink *lastone;
         void linkup(Employeelink, Applicant);
         int best(void);       

   start = NULL;
   lastone = NULL;                  

Promosion::linkup(Employeelink applicant, Applicant app)
   Employeelink *another, *last, *here;
   another = new Employeelink;
   another->id =;
   another->skillLevel = applicant.skillLevel;
   another->yearsWorked = applicant.yearsWorked;
   another->item = app;
   another->next = lastone;
   lastone = another;

   if(start == NULL)
     start = another;
     start->before = NULL;

  float best[18];
  int i = 0;
  float largest = 0;
  float totalBest;
  char bestSkill[18];
  int bestID[18];
  int bestYears[18];
  int bYears;
  int bID;
  char bSkill;
  //boolean once = false;
  Employeelink *point = lastone;
  while(point != NULL)
    best[i] = point->item.return_value();
    bestSkill[i] = point->item.return_skill();
    bestID[i] = point->item.return_id();
    bestYears[i] = point->item.return_years();
    //cout << point->item.return_value() << endl;
    point = point->next;
  for(int x = 0; x < i; x++)
      if(best[x] > largest)
         largest = best[x];
         bYears = bestYears[x];
         bID = bestID[x];
         bSkill = bestSkill[x];
  cout << "ID: " << bID << " Sill Level: " << bSkill << " Years worked: " << bYears << " Value: " << largest << endl;

 int x = 0;
 ifstream partin;
 Employeelink emp, temp;
 Promosion applicant;"applicnt.dat");  
    cout << "Error: Unable to open file!" << endl;  
 while(partin >> >> emp.skillLevel >> emp.yearsWorked)
    Applicant app;
    //cout << app.return_skill() << endl;

    applicant.linkup(emp, app);    

I think that I may not have linked up correctly on this one, but I'm not sure.

I would agree that it does not look like it is quite linked up right.

Where is the Applicant class defined? (I see Applicant app but not the class, does this compile?)

I'm not sure, but it appears that you are repeating some (or all) of the data from the Applicant inside the Employeelink (which contains an Applicant). This is normally an indication of a faulty design.

The class Promosion appears to contain a (doubly) linked list of Employeelink instances.

The method Promosion::linkup(Employeelink applicant, Applicant app) appears to want to add a new Employeelink to the list. The method should always set both the next and before members of the Employeelink. The before is only set if the records we added was the first. And the next always points to where lastone was pointing, but then lastone is set to point to the new record.

I wish I could draw pictures in here...they seem to work the best to describe how this should work, but I'll try to do it in text.

Initially, the list is empty. (start = null, lastone = null)

When you add the first record (we'll call it A for now)

start -> A, lastone -> A, A.before -> null, -> null

Now when you add B, you would normally add it at the head or the tail of the list (unless its an ordered list, but I don't see any support for that). This example adds it to the tail of the list.

start -> A, lastone -> B, A.before -> null, -> B, B.before -> A, -> null

When you add C, it just extends:
start -> A, lastone -> C, A.before -> null, -> B, B.before -> A, -> C, C.before -> B, -> null

You don't normally have to re-assign all of the values in the method that adds the new object, just the ones that have changed.

Once you fix the add method to do something like the above, the best member will need to be changed too. To visit all of the members in the linked list, you either begin at start and follow next links or begin at lastone and follow before links.