<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linked Representation | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/linked-representation/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Mon, 31 Jan 2011 12:14:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ program to implement Queue using Linked Representation</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-linked-representation/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-linked-representation/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 12:14:56 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[linked list]]></category>
		<category><![CDATA[Queue]]></category>
		<category><![CDATA[Linked Representation]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1267</guid>

					<description><![CDATA[<p>#include template class Node { friend LinkedQueue; private: T data; Node *link; }; template class LinkedQueue { public: LinkedQueue() {front = rear = 0;} // constructor ~LinkedQueue(); // destructor int IsEmpty() const {return ((front) ? 0 : 1);} T First() const; // return first element T Last() const; // return last element LinkedQueue&#038; Add(const T&</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-linked-representation/">C++ program to implement Queue using Linked Representation</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
template<class T>
class Node
{
	friend LinkedQueue<T>;
	private:
	T data;
	Node<T> *link;
};
template<class T>
class LinkedQueue {
	public:
		LinkedQueue() {front = rear = 0;} // constructor
		~LinkedQueue(); // destructor
		int IsEmpty() const
		{return ((front) ? 0 : 1);}
		T First() const; // return first element
		T Last() const; // return last element
		LinkedQueue<T>& Add(const T& x);
		LinkedQueue<T>& Delete(T& x);
	private:
		Node<T> *front;  // pointer to first node
		Node<T> *rear;   // pointer to last node
};

	template<class T>
LinkedQueue<T>::~LinkedQueue()
{// Queue destructor.  Delete all nodes.
	Node<T> *next;
	while (front) {
		next = front->link;
		delete front;
		front = next;
	}
}
template<class T>
T LinkedQueue<T>::First() const
{
	if (IsEmpty())   { cout<<"OutOfBounds()";  return -1; };
	return front->data;
}
template<class T>
T LinkedQueue<T>::Last() const
{
	if (IsEmpty()) { cout<<"OutOfBounds()";    return -1; };
	return rear->data;
}
	template<class T>
LinkedQueue<T>& LinkedQueue<T>::Add(const T& x)
{
	Node<T> *p = new Node<T>;
	p->data = x;
	p->link = 0;
	if (front) rear->link = p;  // queue not empty
	else front = p;             // queue empty
	rear = p;
	return *this;
}
	template<class T>
LinkedQueue<T>& LinkedQueue<T>::Delete(T& x)
{
	if (IsEmpty()) {  cout<<"OutOfBounds()"; return *this; };
	x = front->data;
	Node<T> *p = front;
	front = front->link;
	delete p;
	return *this;
}
void main(void)
{
	LinkedQueue<int> Q;
	int x;
	Q.Add(1).Add(2).Add(3).Add(4);
	cout << "No queue add failed" << endl;
	cout << "Queue is now 1234" << endl;
	Q.Delete(x);
	cout << "Deleted " << x << endl;
	cout << Q.First() << " is at front" << endl;
	cout << Q.Last() << " is at end" << endl;
	Q.Delete(x);
	cout << "Deleted " << x << endl;
	Q.Delete(x);
	cout << "Deleted " << x << endl;
	Q.Delete(x);
	cout << "Deleted " << x << endl;
	cout << "No queue delete failed " << endl;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-linked-representation/">C++ program to implement Queue using Linked Representation</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-linked-representation/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
