*********************************************
*what can I put in the function throwOff to * *eliminate the X's from the lists? *
*********************************************
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
#include "apstring.h"
struct NODE {
char info;
NODE *next;
};
void createList (NODE *&head, apstring passenger, int len);
void print (NODE *head);
void throwOff(NODE *&head, apstring passenger);
int main()
{
NODE *head = 0;
apstring passenger = "OOOOOXXXXOOXXOXOOXOXOXXOXXOOXX";
createList (head, passenger);
print(head);
}
void createList (NODE *&head, apstring passenger, int len)
{
NODE *back = head, *tempNode;
int i, len = passenger.length();
for (i = 0; i < len; i++)
{
tempNode = new NODE;
tempNode -> info = passenger[i];
tempNode -> next = 0;
if(!head)
{
head = tempNode;
back = tempNode;
}
else
{
back -> next = tempNode;
back = tempNode;
}
}
back -> next = head;
}
void print (NODE *head)
{
if (!head)
cout <<"Empty List" <<endl;
else
{
NODE *currPtr = head;
do
{
cout <<setw(5) <<currPtr -> info;
currPtr = currPtr -> next;
}
while (currPtr != head);
}
cout <<endl;
}
void throwOff(NODE *&head, apstring passenger)
{
int i, count = 2;
NODE *ptr;
createList(head, passenger);
if(ptr -> info != 'X')
{
ptr = ptr -> next;
while(count <= 15 && count <= len - 1)
{
while(ptr -> info == 'X')
{
for(i = 1; i < count; i++)
{
}
count++;
}
}
}
}