大大们,帮忙做一下队列在链式存储结构(要C++的)

来源:百度知道 编辑:UC知道 时间:2024/05/15 12:43:51
队列在链式存储结构的建立、插入、删除、查找等运算。这要怎么做啊
一定要是C++的啊,我本来是学VB的,选错了上的C++的数据结构,C++的勉强能看懂,C完全不明白
最好是这样一类的格式~~谢谢诸位了!
#include "iostream.h"
class Node
{
public:
int value;
Node * next;
public:
Node(int i)
{
value = i;
next = NULL;
}
};

class LinkedList
{
private:
Node *head;
Node *tail;
public:
LinkedList()
{
head = NULL;
tail = NULL;
}
void print();
void addNode(int value);
void insert(int value);
};

void LinkedList:: print()
{
Node *temp=head;
while (temp!=NULL)
{
cout<<temp->value<<",";
temp = temp->next;
}
}

void LinkedList::addNode(int value)
{
Node *newNode;
newNode = new Node(value);
if (head ==

把你的邮箱留在我空间的留言板上 我明天给你源文件

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>
typedef int ElemType;

typedef struct QNode
{
ElemType data;
struct QNode *next;
}QNode;
typedef struct
{
QNode *front, *rear;
}L_Queue;

L_Queue Q1;
void init_Q(L_Queue *Q);
void out_Q(L_Queue *Q);
void EnQueue(L_Queue *Q,ElemType e);
ElemType DeQueue(L_Queue *Q);
void find(L_Queue *Q, ElemType y);

int main()
{
int k,y;
ElemType e,x;
char ch;
init_Q( &Q1);
do
{