having trouble with the print and the main

#include <fstream>        
#include <iostream>
using namespace std;

struct Item
{
       int value;
       Item *next;
};

class Queue
{
      protected:
                Item *fill;
                Item * remove;
      public:
             void addingtoqueue(int);
             int takeaway(void);
             
             bool empty (void);
             Queue (void);
            
             
};

class Merge: public Queue
{

      protected:
                Item *merge(Item*,Item*);
                Item *mergesort(Item*);
                Item *divide(Item*);
      public:
            void print(void);
            Item* merge_sort(Item*);
          
};


      
Queue::Queue()
{
        fill = NULL;
        remove = NULL;
        
}
void Queue::addingtoqueue(int x)
{
     Item *p;
     p = new(Item);
     p -> value = x;
    
   if( remove == NULL)
       {
           remove = p;
           p-> next = NULL;
           fill = p;
       }
    else
    {
     fill -> next = p;
     p-> next = NULL;
     fill = p;
   }
}


bool Queue:: empty()
{
     if( fill == NULL)
     return true;
     
     else
     {
         return false;
     }
     
}
Item *
 Merge::divide (Item *a)
{
        Item * b, *c;
        b = a;
        c = a -> next;
        c = c -> next;
        
        while( c != NULL)
        {
               c = c-> next;
               b = b -> next;
        
               
               if ( c!= NULL)
               c = c -> next;
        }      
               c = b -> next;
               b -> next = NULL;
          
               return c;
}        

 
Item* Merge:: mergesort(Item *p)
{
     Item *q;
     
     if(p!= NULL)
     {
            if( p->next !=NULL)
            
                q = divide(p);
                p = mergesort(p);
                p = merge(p,q);
            
     }
     return p;
}

Item* Merge:: merge( Item *p, Item *q)
{
       Item *r ,* start;
       if( p-> value < q -> value)
       {
           r = p;
           p = p -> next;
           start = r;
       }
       else
       {
           r = q;
           q = q -> next;
           start = r;
       }
       
       while( p != NULL && q != NULL)
       {
              if( p -> value < q -> value)
              {
                   r -> next = p;
                   r = p;
                   p = p -> next;
              }
              else
              {
                  r -> next = q;
                  r = q;
                  q = q -> next;
              }
              
       }

         if( p == NULL)
         {
             r ->next = q;
         }
         else
         r -> next = p;
         return start;
}           


void Merge::print()
{
    
    

}

int main()
{
    
    
    int value,x;
    
    Merge Y;
    
    cout<< " Please enter a value  " << endl;
    
     
    while(  x != '0')
    {
          cin>>x;
          Y.addingtoqueue(x); 
          cout<< " You entered" << x << endl;
                       
    
     }
      
      
      cout<< " the values sorted "<< Y.merge(x,value) << endl;
      cout<< " the list of of the values sorted " << Y.mergesort(value)<<endl;
      
      system("pause");
          return 0;

}

> having trouble with the print and the main
The only problem with print is that you don't have any code there!

Besides, printing is easy compared to the code you've "written" so far.

Give it a shot - don't just dump "it doesn't work" code on us, and expect us to finish it off for you.

i apologize if you believe that i was just dumping code on you and expecting the people here to finish it for me. all i'm actually asking for a little guidance and help in solving the problem that i have in getting it to compile. i've been working on it and the following is the progress i've made so far.

#include <fstream>        
#include <iostream>
using namespace std;

struct Item
{
       int value;
       Item *next;
};

class Queue
{
      protected:
                Item *fill;
                Item * remove;
      public:
             void addingtoqueue(int);
             int takeaway(void);
             void print();              
             bool empty (void);
             Queue (void);
            
             
};

class Merge: public Queue
{

      protected:
                Item *merge(Item*,Item*);
                Item *mergesort(Item*);
                Item *divide(Item*);
      public:
            void print(void);
            Item *merge_sort(Item*);
            Item *divide_d(Item*,Item*);
            Item *merge_m(Item*);
};


      
Queue::Queue()
{
        fill = NULL;
        remove = NULL;
        
}
void Queue::addingtoqueue(int x)
{
     Item *p;
     p = new(Item);
     p -> value = x;
    
   if( remove == NULL)
       {
           remove = p;
           p-> next = NULL;
           fill = p;
       }
    else
    {

     fill -> next = p;
     p-> next = NULL;
     fill = p;
   }
}


bool Queue:: empty()
{
     if( fill == NULL)
     return true;
     
     else
     {
         return false;
     }
     
}
Item *
 Merge::divide(Item *a)
{
        Item * b, *c;
        b = a;
        c = a -> next;
        c = c -> next;
        
        while( c != NULL)
        {
               c = c-> next;
               b = b -> next;
        
               
               if ( c!= NULL)
               c = c -> next;
        }      
               c = b -> next;
               b -> next = NULL;
          
               return c;
}        

 
Item* Merge:: merge_sort(Item *p)
{
     Item *q;
     
     if(p!= NULL)
     {
            if( p->next !=NULL)
            
                q = divide(p);
                p = mergesort(p);
                p = merge(p,q);
            
     }
     return p;
}

Item* Merge::merge( Item *p, Item *q)
{
       Item *r,*start;
       if( p-> value < q -> value)
       {
           r = p;
           p = p -> next;
           start = r;
       }
       else
       {
           r = q;
           q = q -> next;
           start = r;
       }
       
       while( p != NULL && q != NULL)
       {
              if( p -> value < q -> value)
              {
                   r -> next = p;
                   r = p;
                   p = p -> next;
              }
              else
              {
                  r -> next = q;
                  r = q;
                  q = q -> next;
              }
              
       }

         if( p == NULL)
         {
             r ->next = q;
         }
         else
         r -> next = p;
         return start;
}           


void Queue::print()
{

    Item *integer;
    
    integer = remove; 
    
    while(integer != NULL)
    {
    
    cout<< integer-> value << endl;
    integer = integer->next;
    }
}

   
    



int main()
{
    
    
    int value,x;
    Queue Z;
    Merge Y;
    
    cout<< " Please enter a value  " << endl;
    
    
    while(  x != '0')
    {
          cin>>x;
          Y.addingtoqueue(value); 
          cout<< " You entered" << x << endl;
                       
    
     }
      
      
      cout<< " the values sorted "<< Y.merge() << endl;
      cout<< " the list of of the values sorted " << Y.merge_sort() <<endl;
      
      
      cout<< x <<endl;
      system("pause");
          return 0;

}
This article has been dead for over six months. Start a new discussion instead.