الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

double _ended Queue

مغلق
بدأه مبرمجة حالمة في 3 نوفمبر 2005 · 13 رد · 919 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مرحبا بالجميع

اولا اهنكئم بعيد الفطر السعيد وجعله خير لجميع المسلمين في كافة بقاع الارض

واود ان اكون عضوة خفيفة على قلوبكم

عنوان الموضوع كان doble ended queue

اني سمعت فيه الاونة الخيرة وحبيت اني اكتبه كبرنامج بغة السي ++

وحاولت كثير ولمدة شهر كامل ضلت محاولاني فاشلة

وحبيت اني اكتب بدايتي لوضع برنامج متكامل وبتفاعلكم معي

فكرته الاساسية انه عبارة عن queue &stack

اني راح اريكم الاساسيات واتمنى تساعدوني في كتابه function

function الاساسية:

GQueue;

GQueue* g_queue_new (void);

void g_queue_free (GQueue *queue);

gboolean g_queue_is_empty (GQueue *queue);

guint g_queue_get_length (GQueue *queue);

void g_queue_reverse (GQueue *queue);

GQueue* g_queue_copy (GQueue *queue);

void g_queue_foreach (GQueue *queue,

GFunc func,

gpointer user_data);

GList* g_queue_find (GQueue *queue,

gconstpointer data);

GList* g_queue_find_custom (GQueue *queue,

gconstpointer data,

GCompareFunc func);

void g_queue_sort (GQueue *queue,

GCompareDataFunc compare_func,

gpointer user_data);

void g_queue_push_head (GQueue *queue,

gpointer data);

void g_queue_push_tail (GQueue *queue,

gpointer data);

void g_queue_push_nth (GQueue *queue,

gpointer data,

gint n);

gpointer g_queue_pop_head (GQueue *queue);

gpointer g_queue_pop_tail (GQueue *queue);

gpointer g_queue_pop_nth (GQueue *queue,

guint n);

gpointer g_queue_peek_head (GQueue *queue);

gpointer g_queue_peek_tail (GQueue *queue);

gpointer g_queue_peek_nth (GQueue *queue,

guint n);

gint g_queue_index (GQueue *queue,

gconstpointer data);

void g_queue_remove (GQueue *queue,

gconstpointer data);

void g_queue_remove_all (GQueue *queue,

gconstpointer data);

void g_queue_insert_before (GQueue *queue,

GList *sibling,

gpointer data);

void g_queue_insert_after (GQueue *queue,

GList *sibling,

gpointer data);

void g_queue_insert_sorted (GQueue *queue,

gpointer data,

GCompareDataFunc func,

gpointer user_data);

void g_queue_push_head_link (GQueue *queue,

GList *link_);

void g_queue_push_tail_link (GQueue *queue,

GList *link_);

void g_queue_push_nth_link (GQueue *queue,

gint n,

GList *link_);

GList* g_queue_pop_head_link (GQueue *queue);

GList* g_queue_pop_tail_link (GQueue *queue);

GList* g_queue_pop_nth_link (GQueue *queue,

guint n);

GList* g_queue_peek_head_link (GQueue *queue);

GList* g_queue_peek_tail_link (GQueue *queue);

GList* g_queue_peek_nth_link (GQueue *queue,

guint n);

gint g_queue_link_index (GQueue *queue,

GList *link_);

void g_queue_unlink (GQueue *queue,

GList *link_);

void g_queue_delete_link (GQueue *queue,

GList *link_);

طبعا اني سويتها ب list linked

لاني ماعرفت اسويها باstack

فاللي يعرف يعلمني الطريقة

/\

/\

/\

يتبع

#2

GQueue

typedef struct {

GList *head;

GList *tail;

guint length;

} GQueue;

Contains the public fields of a Queue

GList *head;

a pointer to the first element of the queue.

GList *tail;

a pointer to the last element of the queue.

guint length;

the number of elements in the queue.

g_queue_new ()

GQueue* g_queue_new (void);

Creates a new GQueue.

Returns : a new GQueue.

g_queue_free ()

void g_queue_free (GQueue *queue);

Frees the memory allocated for the GQueue.

queue : a GQueue.

g_queue_is_empty ()

gboolean g_queue_is_empty (GQueue *queue);

Returns TRUE if the queue is empty.

queue : a GQueue.

Returns : TRUE if the queue is empty.

g_queue_get_length ()

guint g_queue_get_length (GQueue *queue);

Returns the number of items in queue.

queue : a GQueue

Returns : The number of items in queue.

g_queue_reverse ()

void g_queue_reverse (GQueue *queue);

Reverses the order of the items in queue.

queue : a GQueue

g_queue_copy ()

GQueue* g_queue_copy (GQueue *queue);

Copies a queue. Note that is a shallow copy. If the elements in the queue consist of pointers to data, the pointers are copied, but the actual data is not.

queue : a GQueue

Returns : A copy of queue

g_queue_foreach ()

void g_queue_foreach (GQueue *queue,

GFunc func,

gpointer user_data);

Calls func for each element in the queue passing user_data to the function.

queue : a GQueue

func : the function to call for each element's data

user_data : user data to pass to func

g_queue_find ()

GList* g_queue_find (GQueue *queue,

gconstpointer data);

Finds the first link in queue which contains data.

queue : a GQueue

data : data to find

Returns : The first link in queue which contains data. .

g_queue_find_custom ()

GList* g_queue_find_custom (GQueue *queue,

gconstpointer data,

GCompareFunc func);

Finds an element in a GQueue, using a supplied function to find the desired element. It iterates over the queue, calling the given function which should return 0 when the desired element is found. The function takes two gconstpointer arguments, the GQueue element's data as the first argument and the given user data as the second argument.

queue : a GQueue

data : user data passed to func

func : a GCompareFunc to call for each element. It should return 0 when the desired element is found

Returns : The found link, or NULL if it wasn't found

g_queue_sort ()

void g_queue_sort (GQueue *queue,

GCompareDataFunc compare_func,

gpointer user_data);

Sorts queue using compare_func.

queue : a GQueue

compare_func : the GCompareDataFunc used to sort queue. This function is passed two elements of the queue and should return 0 if they are equal, a negative value if the first comes before the second, and a positive value if the second comes before the first.

user_data : user data passed to compare_func

g_queue_push_head ()

void g_queue_push_head (GQueue *queue,

gpointer data);

Adds a new element at the head of the queue.

queue : a GQueue.

data : the data for the new element.

g_queue_push_tail ()

void g_queue_push_tail (GQueue *queue,

gpointer data);

Adds a new element at the tail of the queue.

queue : a GQueue.

data : the data for the new element.

g_queue_push_nth ()

void g_queue_push_nth (GQueue *queue,

gpointer data,

gint n);

Inserts a new element into queue at the given position

queue : a GQueue

data : the data for the new element

n : the position to insert the new element. If n is negative or larger than the number of elements in the queue, the element is added to the end of the queue.

g_queue_pop_head ()

gpointer g_queue_pop_head (GQueue *queue);

Removes the first element of the queue.

queue : a GQueue.

Returns : the data of the first element in the queue, or NULL if the queue is empty.

g_queue_pop_tail ()

gpointer g_queue_pop_tail (GQueue *queue);

Removes the last element of the queue.

queue : a GQueue.

Returns : the data of the last element in the queue, or NULL if the queue is empty.

g_queue_pop_nth ()

gpointer g_queue_pop_nth (GQueue *queue,

guint n);

Removes the n'th element of queue.

queue : a GQueue

n : the position of the element.

Returns : the element's data, or NULL if n is off the end of queue.

g_queue_peek_head ()

gpointer g_queue_peek_head (GQueue *queue);

Returns the first element of the queue.

queue : a GQueue.

Returns : the data of the first element in the queue, or NULL if the queue is empty.

g_queue_peek_tail ()

gpointer g_queue_peek_tail (GQueue *queue);

Returns the last element of the queue.

queue : a GQueue.

Returns : the data of the last element in the queue, or NULL if the queue is empty.

g_queue_peek_nth ()

gpointer g_queue_peek_nth (GQueue *queue,

guint n);

Returns the n'th element of queue.

queue : a GQueue

n : the position of the element.

Returns : The data for the n'th element of queue, or NULL if n is off the end of queue.

g_queue_index ()

gint g_queue_index (GQueue *queue,

gconstpointer data);

Returns the position of the first element in queue which contains data.

queue : a GQueue

data : the data to find.

Returns : The position of the first element in queue which contains data, or -1 if no element in queue contains data.

g_queue_remove ()

void g_queue_remove (GQueue *queue,

gconstpointer data);

Removes the first element in queue that contains data.

queue : a GQueue

data : data to remove.

g_queue_remove_all ()

void g_queue_remove_all (GQueue *queue,

gconstpointer data);

Remove all elemeents in queue which contains data.

queue : a GQueue

data : data to remove

Since 2.4

g_queue_insert_before ()

void g_queue_insert_before (GQueue *queue,

GList *sibling,

gpointer data);

Inserts data into queue before sibling.

sibling must be part of queue.

queue : a GQueue

sibling : a GList link that must be part of queue

data : the data to insert

g_queue_insert_after ()

void g_queue_insert_after (GQueue *queue,

GList *sibling,

gpointer data);

Inserts data into queue after sibling

sibling must be part of queue

queue : a GQueue

sibling : a GList link that must be part of queue

data : the data to insert

g_queue_insert_sorted ()

void g_queue_insert_sorted (GQueue *queue,

gpointer data,

GCompareDataFunc func,

gpointer user_data);

Inserts data into queue using func to determine the new position.

queue : a GQueue

data : the data to insert

func : the GCompareDataFunc used to compare elements in the queue. It is called with two elements of the queue and user_data. It should return 0 if the elements are equal, a negative value if the first element comes before the second, and a positive value if the second element comes before the first.

user_data : user data passed to func.

g_queue_push_head_link ()

void g_queue_push_head_link (GQueue *queue,

GList *link_);

Adds a new element at the head of the queue.

queue : a GQueue.

link_ : a single GList element, not a list with more than one element.

g_queue_push_tail_link ()

void g_queue_push_tail_link (GQueue *queue,

GList *link_);

Adds a new element at the tail of the queue.

queue : a GQueue.

link_ : a single GList element, not a list with more than one element.

g_queue_push_nth_link ()

void g_queue_push_nth_link (GQueue *queue,

gint n,

GList *link_);

Inserts link into queue at the given position.

queue : a GQueue

n : the position to insert the link. If this is negative or larger than the number of elements in queue, the link is added to the end of queue.

link_ : the link to add to queue

g_queue_pop_head_link ()

GList* g_queue_pop_head_link (GQueue *queue);

Removes the first element of the queue.

queue : a GQueue.

Returns : the GList element at the head of the queue, or NULL if the queue is empty.

g_queue_pop_tail_link ()

GList* g_queue_pop_tail_link (GQueue *queue);

Removes the last element of the queue.

queue : a GQueue.

Returns : the GList element at the tail of the queue, or NULL if the queue is empty.

g_queue_pop_nth_link ()

GList* g_queue_pop_nth_link (GQueue *queue,

guint n);

Removes and returns the link at the given position.

queue : a GQueue

n : the link's position

Returns : The n'th link, or NULL if n is off the end of queue.

g_queue_peek_head_link ()

GList* g_queue_peek_head_link (GQueue *queue);

Returns the first link in queue

queue : a GQueue

Returns : the first link in queue, or NULL if queue is empty

g_queue_peek_tail_link ()

GList* g_queue_peek_tail_link (GQueue *queue);

Returns the last link queue.

queue : a GQueue

Returns : the last link in queue, or NULL if queue is empty

g_queue_peek_nth_link ()

GList* g_queue_peek_nth_link (GQueue *queue,

guint n);

Returns the link at the given position

queue : a GQueue

n : the position of the link

Returns : The link at the n'th position, or NULL if n is off the end of the list

g_queue_link_index ()

gint g_queue_link_index (GQueue *queue,

GList *link_);

Returns the position of link_ in queue.

queue : a Gqueue

link_ : A GList link

Returns : The position of link_, or -1 if the link is not part of queue

g_queue_unlink ()

void g_queue_unlink (GQueue *queue,

GList *link_);

Unlinks link_ so that it will no longer be part of queue. The link is not freed.

link_ must be part of queue,

queue : a GQueue

link_ : a GList link that must be part of queue

g_queue_delete_link ()

void g_queue_delete_link (GQueue *queue,

GList *link_);

Removes link_ from queue and frees it.

link_ must be part of queue.

queue : a GQueue

link_ : a GList link that must be part of queue

#3

لشو ماحدا رد علي

؟!!!!

#4

بدك سورس كود للـ ستاك و كيو ؟

#5

ايه بدي زي ماحكيت

يعني بدي اعمل برنامج متكامل

ممنو حدى فاهم علي يعني؟!!!

#6

هذا صنف الكيو

يستخدم اللاوائح المترابطة

سلام

#include <iostream.h>

//---------------------------------------------------------------------

struct Node 
{
	int Data; 
	Node * Next; 
};

//---------------------------------------------------------------------

class TQueue 
{
	Node * Start , * End; 

public: 

	TQueue (); 
	TQueue ( int );

	void Write ( int ); 
	int Read ();

};

TQueue :: TQueue () 
{
	End = new Node;
	Start = End; 
}

TQueue :: TQueue ( int num ) 
{
	End = new Node; 
	Start = End;
	End->Data = num; 
	Node * Temp = new Node;
	End->Next = Temp; 
	End = Temp; 
	End->Next = NULL; 
}

void TQueue :: Write ( int num ) 
{
	Node * Temp = new Node;
	End->Data = num; 
	End->Next = Temp; 
	End = Temp; 
	End ->Next = NULL; 
}

int TQueue :: Read () 
{
	if ( Start == End ) 
	{
  cout << "End Of Queue .'\n"  << "Use 1 Command To Enter New Numbers ."; 
  return NULL;
	}
	else 
	{
  cout << "The Data Is : "; 
  int num = Start->Data; 
  Node * Temp = Start; 
  Start = Start->Next; 
  delete Temp; 
  return num; 
	}
}

//---------------------------------------------------------------------

void Show ( TQueue Q1 ) 
{
	int num; 
	int choose; 
	do
	{
  cout << "Enter 0 To Exit 1 To Write Number 2 To Read Number : "; 
  cin >> choose; 
  switch ( choose ) 
  {
  case 0 :
   	 cout << "Good Bye And Have a Nice Day "; 
  break; 
  case 1 :
   	 cout << "Enter A Number : ";
   	 cin >> num; 
   	 Q1.Write ( num ); 
  break; 
  case 2 :
      cout << Q1.Read () << '\n'; 
  break; 
  default	:	cout << "Choose One of Three Options Thear Plees ! \n"; 
  }
	cout << '\n'; 

	}while ( choose != 0 ); 
}

//---------------------------------------------------------------------

void main ()
{
	TQueue Q1; 
	Show ( Q1 ); 
}
//---------------------------------------------------------------------
#7

The word deque (pronounced either “deck” or “DQ”) is a shortened form of double-ended queue and denotes a list in which entries can be added or removed from either the first or the last position of the list, but no changes can be made elsewhere in the list. Thus a deque is a generalization of both a stack and a queue. The fundamental operations on a deque are append_front, append_rear, serve_front, serve_rear, retrieve_front, and retrieve_rear.

1. Write the methods needed to implement a deque in a circular array. Consider the class Deque as derived from the class Queue.

2. In the main program initialize a deque with the following letters: D A T A

3. Write a menu driven that permits to the user to:

• A- Append the next input character to the rear.

• P- Push the next input character to the front.

• S- Serve the front of the queue.

• X- Extract the rear of the queue.

• R- Retrieve and print the front entry.

• W- Retrieve and write the rear entry.

• Q- quit.

#8

help file

//

// File: stackat.h. Generic class, constant values, and type and

// method definitions for C++ array implementation of ADT stack.

//

#ifndef STACKAGO_H

#define STACKAGO_H

#include <iostream.h>

#include <stdlib.h>

// application dependent size of stack

const unsigned int MAX_NUM_ELS = 256;

#ifndef BOOLEAN_T

#define BOOLEAN_T

enum boolean_t {FALSE, TRUE};

#endif

typedef int index_t;

template < class T >

class stack {

public:

stack(); // stack constructor

~stack(); // stack destructor

boolean_t StackIsEmpty (void); // is stack empty?

boolean_t StackIsFull (void); // is stack full?

void Push (T ); // push item

void Pop (T& ); // pop top item

private:

void StackError(char*); // error handler

index_t top; // top index; -1 if empty

T el[MAX_NUM_ELS]; // container for elements

};

//

// Default constructor

// Pre: none

// Post: The stack object is initialized to be empty.

//

template < class T >

stack< T >::stack()

{

top = -1;

}

//

// Stack destructor

// Pre: The stack has gone out of scope or an explicit call

// to ~stack has occurred.

// Post: The stack is empty.

//

template < class T >

stack< T >::~stack()

{

top = -1;

}

//

// Boolean function that returns TRUE if the stack is empty

// Pre: The stack has been initialized.

// Post: The function returns TRUE if the stack is empty,

// FALSE otherwise.

//

template < class T >

boolean_t stack< T >::StackIsEmpty(void)

{

return (top == -1 ? TRUE : FALSE);

}

//

// Boolean function to return TRUE if a stack is full

// Pre: The stack has been initialized.

// Post: The function has returned TRUE if the stack is full,

// FALSE otherwise.

//

template < class T >

boolean_t stack< T >::StackIsFull(void)

{

return (top == (MAX_NUM_ELS - 1) ? TRUE : FALSE);

}

//

// Function to push an element onto a non-full stack

// Pre: e is a data element of type el_t.

// The stack is not full.

// Post: If the stack was not full, e was placed on top of

// the stack; otherwise StackError was called.

//

template < class T >

void stack< T >::Push(T e)

{

if(StackIsFull())

StackError("Stack is full\n");

else

{

++top;

el[top] = e;

}

}

//

// Function to pop an element from a nonempty stack and

// store it in the referenced variable

// Pre: The stack is nonempty.

// Post: The top stack element has been removed and stored

// in e. If the stack was empty, StackError was called.

//

template < class T >

void stack< T >::Pop(T& e)

{

if(StackIsEmpty())

StackError("Stack is empty\n");

else

{

e = el[top];

--top;

}

}

//

// Function to print an error message and abort the program

// Pre: An unrecoverable error has occurred.

// ErrorMessage is an error message.

// Post: ErrorMessage has been output and the program aborted.

//

template < class T >

void stack< T >::StackError(char* ErrorMessage)

{

cerr << ErrorMessage;

exit(1);

}

#endif

#9

//

// File: stackao.h. Class, constant values, and type

// definitions for C++ static implementation of ADT stack

//

#ifndef STACKAO_H

#define STACKAO_H

// application dependent size of stack

const unsigned int MAX_NUM_ELS = 256;

#ifndef BOOLEAN_T

#define BOOLEAN_T

enum boolean_t {FALSE, TRUE};

#endif

// typedef char el_t; // type varies with application

typedef int el_t; // type varies with application

typedef int index_t;

class stack {

public:

stack(); // stack constructor

~stack(); // stack destructor

boolean_t StackIsEmpty (void); // is stack empty?

boolean_t StackIsFull (void); // is stack full?

void Push (el_t); // push item

void Pop (el_t&); // pop top item

private:

void StackError(char*); // error handler

index_t top; // top index; -1 if empty

el_t el[MAX_NUM_ELS]; // container for elements

};

#endif

#10

//

// File: stackao.cpp. Contents: C++ source code for static

// implementation of ADT stack

//

#include <iostream.h>

#include <stdlib.h>

#include "stackao.h"

//

// Default constructor

// Pre: none

// Post: The stack object is initialized to be empty.

//

stack::stack( void )

{

top = -1;

}

//

// Stack destructor

// Pre: The stack has gone out of scope or an explicit call

// to ~stack has occurred.

// Post: The stack is empty.

//

//

stack::~stack()

{

top = -1;

}

//

// Boolean function that returns TRUE if the stack is empty

// Pre: The stack has been initialized.

// Post: The function returns TRUE if the stack is empty,

// FALSE otherwise.

//

boolean_t stack::StackIsEmpty(void)

{

return (top == -1 ? TRUE : FALSE);

}

//

// Boolean function to return TRUE if a stack is full

// Pre: The stack has been initialized.

// Post: The function has returned TRUE if the stack is full,

// FALSE otherwise.

//

boolean_t stack::StackIsFull(void)

{

return (top == (MAX_NUM_ELS - 1) ? TRUE : FALSE);

}

//

// Function to push an element onto a non-full stack

// Pre: e is a data element of type el_t.

// The stack is not full.

// Post: If the stack was not full, e was placed on top of

// the stack; otherwise StackError was called.

//

void stack::Push(el_t e)

{

if(StackIsFull())

StackError("Stack is full\n");

else

{

++top;

el[top] = e;

}

}

//

// Function to pop an element from a nonempty stack and

// store it in the referenced variable

// Pre: The stack is nonempty.

// Post: The top stack element has been removed and stored

// in e. If the stack was empty, StackError was called.

//

void stack::Pop(el_t& e)

{

if(StackIsEmpty())

StackError("Stack is empty\n");

else

{

e = el[top];

--top;

}

}

//

// Function to print an error message and abort the program

// Pre: An unrecoverable error has occurred.

// ErrorMessage is an error message.

// Post: ErrorMessage has been output and the program aborted.

//

void stack::StackError(char* ErrorMessage)

{

cerr << ErrorMessage;

exit(1);

}

#11

//

// File: queueao.h. Class and type definitions for a

// static implementation of ADT queue

//

#ifndef QUEUEOBJ_H

#define QUEUEOBJ_H

// application dependent size of queue

const unsigned int QUEUE_SIZE = 256;

#ifndef BOOLEAN_T

#define BOOLEAN_T

enum boolean_t {FALSE, TRUE};

#endif

#include "el_t.h"

typedef int index_t;

typedef unsigned int count_t;

// class definition for queue ADT

class queue {

public:

queue (void ); // default constructor

~queue (void ); // default destructor

boolean_t QueueIsEmpty (void ); // is queue empty?

boolean_t QueueIsFull (void ); // is queue full?

void EnQueue (el_t ); // enqueue item

void DeQueue (el_t&); // dequeue item

el_t RetrieveQueue(void ); // retrieve front item

protected:

void QueueError(char*); // error handler

index_t front; // front index

index_t rear; // rear index

count_t count; // number of elements

el_t el[ QUEUE_SIZE ]; // container for elements

};

#endif

#12

//

// File: queueao.cpp. Contents: C++ source code for array

// implementation of ADT queue

//

#include <iostream.h>

#include <stdlib.h>

#include "queueao.h"

//

// Default queue constructor

// Pre: none

// Post: The queue is initialized to be empty.

//

queue::queue(void)

{

front = 1;

rear = 0;

count = 0;

}

//

// Queue destructor

// Pre: The queue has gone out of scope or an explicit call

// to ~queue has occurred.

// Post: The queue is empty.

//

queue::~queue(void)

{

front = 1;

rear = 0;

count = 0;

}

//

// Boolean function that returns TRUE if the queue is empty

// Pre: The queue has been initialized.

// Post: The function returns TRUE if the queue is empty,

// FALSE otherwise.

//

boolean_t queue::QueueIsEmpty(void)

{

return ((count == 0) ? TRUE : FALSE);

}

//

// Boolean function to return TRUE if a queue is full

// Pre: The queue has been initialized.

// Post: The function has returned TRUE if the queue is full,

// FALSE otherwise.

//

boolean_t queue::QueueIsFull(void)

{

return((count == QUEUE_SIZE) ? TRUE : FALSE);

}

//

// Function to enqueue an element into a nonfull queue

// Pre: e is a data element of type el_t.

// The queue is not full.

// Post: If the queue was not full, e was placed at the rear

// of the queue; otherwise QueueError was called.

//

void queue::EnQueue(el_t e)

{

if (QueueIsFull())

QueueError("Queue is full\n");

else

{

rear = (rear + 1) % QUEUE_SIZE;

el[rear] = e;

count++;

}

}

//

// Function to remove an element from the front of a queue

// and store it in the referenced variable

// Pre: The queue is nonempty.

// Post: If the queue was not empty, the front element

// has been removed and stored in e; otherwise

// QueueError was called.

//

void queue::DeQueue(el_t& e)

{

if(QueueIsEmpty())

QueueError("Queue is empty\n");

else

{

e = el[front];

front = (front + 1) % QUEUE_SIZE;

count--;

}

}

//

// Function to return the front element of a queue

// Pre: The queue is nonempty.

// Post: If the queue was not empty, the front element

// has been returned; otherwise QueueError was

// called.

//

//

el_t queue::RetrieveQueue(void)

{

if(QueueIsEmpty())

QueueError("Queue is empty\n");

return (el[front]);

}

//

// Function to print an error message and abort the program

// Pre: An unrecoverable error has occurred.

// ErrorMessage is an error message.

// Post: ErrorMessage has been output and the program aborted.

//

void queue::QueueError(char* ErrorMessage)

{

cerr << ErrorMessage << endl;

exit(1);

}

#13

شو بدي اعمل في هيك حالة ؟؟

#14
اقتباس
اقتباس
بدك سورس كود للـ ستاك و كيو ؟

ايه بدي زي ماحكيت

يعني بدي اعمل برنامج متكامل

ممنو حدى فاهم علي يعني؟!!!

طلب حل جاهز .. وواجب طويل جدا ايضا!!!

لا يظهر ان صاحب المشاركة قام بأي مجهود, ولا حتى محاولة, و لا يوجد شي من كلامه يدل على انه فاهم شئ في الموضوع.

إذا كان هناك جزئيات معينة لم تفهمها, فقم بفتح موضوع جديد يسأل عن تلك الجزئيات, اما إن كنت تريد فقط الحل الجاهز, فالمنتدى ليس لتقديم ذلك.

الموضوع مغلق

هذا الموضوع مغلق.

مواضيع مشابهة