multiple types in one declaration
Here is my code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
#ifndef QUEUE_H
#define QUEUE_H
#include "Message.h"
#include <iostream>
using namespace std;
class Node
{
public:
Message msg;
Node* next;
}
class Queue
{
public:
Node *front;
Node *rear;
int numItems;
Queue()
{
front = NULL;
rear = NULL;
numItems = 0;
}
void add(Message m)
{
Node *newnode;
newnode = new Node();
newnode->msg = m;
newnode->next = NULL;
if(isEmpty())
{
front = newnode;
rear = newnode;
}
else
{
rear->next = newnode;
rear = newnode;
}
numItems++;
}
void remove(Message &m)
{
Node *temp;
if(isEmpty())
{
cout << "The queue is empty\n";
}
else
{
m = front->msg;
temp = front;
front = front->next;
delete temp;
numItems--;
}
}
bool isEmpty() const
{
bool status;
if(numItems>0)
status = false;
else
status = true;
return status;
}
bool isFull()
{
return false;
}
int size()
{
return numItems;
}
};
#endif
|
There is error: "multiple types in one declaration". I couldn't find out where mistake is.
Last edited on
try putting a ; after the } on line 12...
thank you
Topic archived. No new replies allowed.