<?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>Formula Based Representation | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/formula-based-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:03:38 +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 Stack using Formula Based Representation</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-stack-using-formula-based-representation/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-stack-using-formula-based-representation/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 03 Feb 2011 10:47:47 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[stack]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[Linked Lists]]></category>
		<category><![CDATA[struct]]></category>
		<category><![CDATA[Formula Based Representation]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1250</guid>

					<description><![CDATA[<p>#include #include template class Stack { public: Stack(int MaxStackSize); ~Stack(){delete[] S;} int IsEmpty()const{return top==-1;} int IsFull()const{return top==MaxTop;} T Peek()const; void Push(T); T Pop(); void Display(); private: int top; //current top of stack int MaxTop; //max val for top T *S; //element array }; template Stack::Stack(int MaxStackSize) { //stack constructor MaxTop=MaxStackSize-1; S=new T[MaxStackSize]; top=-1; } template</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-stack-using-formula-based-representation/">C++ program to implement Stack using Formula Based Representation</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include<iostream.h>
#include<constream.h>
template<class T>
class Stack
{
	public:
		Stack(int MaxStackSize);
		~Stack(){delete[] S;}
		int IsEmpty()const{return top==-1;}
		int IsFull()const{return top==MaxTop;}
		T Peek()const;
		void Push(T);
		T Pop();
		void Display();
	private:
		int top; //current top of stack
		int MaxTop; //max val for top
		T *S; //element array
};
	template<class T>
Stack<T>::Stack(int MaxStackSize)
{
	//stack constructor
	MaxTop=MaxStackSize-1;
	S=new T[MaxStackSize];
	top=-1;
}
template<class T>
T Stack<T>::Peek()const
{
	if(IsEmpty()) //top fails
		return 0;
	else
		return S[top];
}
	template<class T>
void Stack<T>::Push(T x)
{
	if(IsFull())
		cout<<"no memory()"; //add fails
	else
	{
		S[++top]=x;
	}
}
	template<class T>
T Stack<T>::Pop()
{
	T x;
	if(IsEmpty())
	{
		cout<<"stack is empty\n";
		return -1;
	}
	else
	{
		x=S[top--];
		return x;
	}
}
	template<class T>
void Stack<T>::Display()
{
	if(IsEmpty())
		cout<<"out of bounds"; //delete fails
	else
		for(int i=top;i>=0;i--)
		{
			cout<<S[i]<<"\t";
		}
}
void menu()
{
	cout<<"1.Push\n 2.Pop\n 3.Peek\n 4.Display\n";
}
void main()
{
	Stack<int>iobj(5);
	int ch,x;
	clrscr();
	do
	{
		menu();
		cout<<"enter the choice\n";
		cin>>ch;
		switch(ch)
		{
			case 1:
				cout<<"enter x value to push into the stack\n";
				cin>>x;
				iobj.Push(x);
				break;
			case 2:
				x=iobj.Pop();
				if(x!=-1)
					cout<<"poped value is \t"<<x<<endl;
				break;
			case 3:
				x=iobj.Peek();
				cout<<"top most value is \t"<<x<<endl;
				break;
			case 4:
				iobj.Display();
				break;
		}
	}while(ch>=1&&ch<=4);
	getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-stack-using-formula-based-representation/">C++ program to implement Stack using Formula Based 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-stack-using-formula-based-representation/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement Queue using Formula Based Representation</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-formula-based-representation/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-formula-based-representation/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 12:03:38 +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[Formula Based Representation]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1265</guid>

					<description><![CDATA[<p>#include #include class queue { private : int *arr ; int front, rear ; int MAX ; public : queue( int maxsize = 10 ) ; void addq ( int item ) ; int delq( ) ; } ; queue :: queue( int maxsize ) { MAX = maxsize ; arr = new int [</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-formula-based-representation/">C++ program to implement Queue using Formula Based Representation</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
#include <conio.h>
class queue
{
	private :

		int *arr ;
		int front, rear ;
		int MAX ;
	public :
		queue( int maxsize = 10 ) ;
		void addq ( int item ) ;
		int delq( ) ;
} ;
queue :: queue( int maxsize )
{
	MAX = maxsize ;
	arr = new int [ MAX ];
	front = -1 ;
	rear = -1 ;
}
void queue :: addq ( int item )
{
	if ( rear == MAX - 1 )
	{
		cout << "\nQueue is full" ;
		return ;
	}
	rear++ ;
	arr[rear] = item ;
	if ( front == -1 )
		front = 0 ;
}
int queue :: delq( )
{
	int data ;

	if ( front == -1 )
	{
		cout << "\nQueue is Empty" ;
		return NULL ;
	}

	data = arr[front] ;
	arr[front] = 0 ;
	if ( front == rear )
		front = rear = -1 ;
	else
		front++ ;

	return  data ;
}
void main( )
{
	queue a (10 ) ;
	clrscr();
	a.addq ( 23 ) ;
	a.addq ( 9 ) ;
	a.addq ( 11 ) ;
	a.addq ( -10 ) ;
	a.addq ( 25 ) ;
	a.addq ( 16 ) ;
	a.addq ( 17 ) ;
	a.addq ( 22 ) ;
	a.addq ( 19 ) ;
	a.addq ( 30 ) ;
	a.addq ( 32 ) ;
	int i = a.delq( ) ;
	cout << "\nItem deleted: " << i ;
	i = a.delq( ) ;
	cout << "\nItem deleted: " << i ;
	i = a.delq( ) ;
	cout << "\nItem deleted: " << i ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-queue-using-formula-based-representation/">C++ program to implement Queue using Formula Based 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-formula-based-representation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
