求C++语言用数组实现一个队列的数据结构的完整代码

提示:定义一个数组,用两个指针表示队列的首尾位置,编写两个函数代表出队入队操作。当队列长度超过数组长度时,提示队列超长,当队列空时,提示队列为空。主程序实现对队列的调用,

 #include <iostream>
using namespace std;

#define ARRSIZE 5

class Queue
{
private:
    int * arr;
    int * start;
    int * end;
    int length;
public:
    Queue()
    {
        arr = new int[ARRSIZE];
        start = end = arr;
        length = 0;
    }
    void enqueue(int x)
    {
        if (length == ARRSIZE)
        {
            cout << "full" << endl;
            throw "error";
        }
        else
        {
            *start = x;
            *start--;
            length++;
            if (start < arr) start = &arr[ARRSIZE - 1];
        }
    }
    int dequeue()
    {
        if (!length)
        {
            cout << "empty" << endl;
            throw "error";
        }
        else
        {
            int result = *end;
            *end--;
            length--;
            if (end < arr) end = &arr[ARRSIZE - 1];
            return result;
        }

    }
};

int main(int argc, _TCHAR* argv[])
{
    Queue q = Queue();
    q.enqueue(1);
    cout << q.dequeue() << endl;
    q.enqueue(2);
    q.enqueue(3);
    cout << q.dequeue() << endl;
    cout << q.dequeue() << endl;
    q.enqueue(4);
    q.enqueue(5);
    q.enqueue(6);
    cout << q.dequeue() << endl;
    cout << q.dequeue() << endl;
    q.enqueue(7);
    cout << q.dequeue() << endl;
    cout << q.dequeue() << endl;
    q.enqueue(8);
    cout << q.dequeue() << endl;
    return 0;
}

这个一般的数据结构的书都有讲。你自己翻翻就行了。这个不难,学知识还是要靠自己。另外你说的这个用C或者C++实现都是可以的