<?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>push | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/push/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 11:59: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 evaluate an expression entered in postfix form</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-evaluate-an-expression-entered-in-postfix-form/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-evaluate-an-expression-entered-in-postfix-form/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 11:59:38 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[postfix form]]></category>
		<category><![CDATA[pop]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[C Programs]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1260</guid>

					<description><![CDATA[<p>#include #include #include #include const int MAX = 50 ; class postfix { private : int stack[MAX] ; int top, nn ; char *s ; public : postfix( ) ; void setexpr ( char *str ) ; void push ( int item ) ; int pop( ) ; void calculate( ) ; void show( )</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-evaluate-an-expression-entered-in-postfix-form/">C++ program to evaluate an expression entered in postfix form</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
const int MAX = 50 ;
class postfix
{
	private :

		int stack[MAX] ;
		int top, nn ;
		char *s ;
	public :
		postfix( ) ;
		void setexpr ( char *str ) ;
		void push ( int item ) ;
		int pop( ) ;
		void calculate( ) ;
		void show( ) ;
} ;
postfix :: postfix( )
{
	top = -1 ;
}
void postfix :: setexpr ( char *str )
{
	s = str ;
}
void postfix :: push ( int item )
{
	if ( top == MAX - 1 )
		cout << endl << "Stack is full" ;
	else
	{
		top++ ;
		stack[top] = item ;
	}
}
int postfix :: pop( )
{
	if ( top == -1 )
	{
		cout << endl << "Stack is empty" ;
		return NULL ;
	}
	int data = stack[top] ;
	top-- ;
	return data ;
}
void postfix :: calculate( )
{
	int n1, n2, n3 ;
	while ( *s )
	{
		if ( *s == ' ' || *s == '\t' )
		{
			s++ ;
			continue ;
		}
		if ( isdigit ( *s ) )
		{
			nn = *s - '0' ;
			push ( nn ) ;
		}
		else
		{
			n1 = pop( ) ;
			n2 = pop( ) ;
			switch ( *s )
			{
				case '+' :
					n3 = n2 + n1 ;
					break ;
				case '-' :
					n3 = n2 - n1 ;
					break ;
				case '/' :
					n3 = n2 / n1 ;
					break ;
				case '*' :
					n3 = n2 * n1 ;
					break ;
				case '%' :
					n3 = n2 % n1 ;
					break ;
				case '$' :
					n3 = pow ( n2 , n1 ) ;
					break ;
				default :
					cout << "Unknown operator" ;
					exit ( 1 ) ;
			}

			push ( n3 ) ;
		}
		s++ ;
	}
}
void postfix :: show( )
{
	nn = pop ( ) ;
	cout << "Result is: " << nn ;
}

void main( )
{
	char expr[MAX] ;
	cout << "\nEnter postfix expression to be evaluated : " ;
	cin.getline ( expr, MAX ) ;
	postfix q ;
	q.setexpr ( expr ) ;
	q.calculate( ) ;
	q.show( ) ;
}

</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-evaluate-an-expression-entered-in-postfix-form/">C++ program to evaluate an expression entered in postfix form</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-evaluate-an-expression-entered-in-postfix-form/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to convert an Expression from Infix expression to Prefix form</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-expression-to-prefix-form/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-expression-to-prefix-form/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 11:55:00 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[infix to postfix]]></category>
		<category><![CDATA[pop]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[infix]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[C Programs]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1257</guid>

					<description><![CDATA[<p>#include #include #include const int MAX = 50 ; class infix { private : char target[MAX], stack[MAX] ; char *s, *t ; int top, l ; public : infix( ) ; void setexpr ( char *str ) ; void push ( char c ) ; char pop( ) ; void convert( ) ; int priority</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-expression-to-prefix-form/">C++ program to convert an Expression from Infix expression to Prefix form</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
#include <string.h>
#include <ctype.h>
const int MAX = 50 ;
class infix
{
	private :
		char target[MAX], stack[MAX] ;
		char *s, *t ;
		int top, l ;
	public :
		infix( ) ;
		void setexpr ( char *str ) ;
		void push ( char c ) ;
		char pop( ) ;
		void convert( ) ;
		int priority ( char c ) ;
		void show( ) ;
} ;
infix :: infix( )
{
	top = -1 ;
	strcpy ( target, "" ) ;
	strcpy ( stack, "" ) ;
	l = 0 ;
}
void infix :: setexpr ( char *str )
{
	s = str ;
	strrev ( s ) ;
	l = strlen ( s ) ;
	* ( target + l ) = '\0' ;
	t = target + ( l - 1 ) ;
}
void infix :: push ( char c )
{
	if ( top == MAX - 1 )
		cout << "\nStack is full\n" ;
	else
	{
		top++ ;
		stack[top] = c ;
	}
}
char infix :: pop( )
{
	if ( top == -1 )
	{
		cout << "Stack is empty\n" ;
		return -1 ;
	}
	else
	{
		char item = stack[top] ;
		top-- ;
		return item ;
	}
}
void infix :: convert( )
{
	char opr ;

	while ( *s )
	{
		if ( *s == ' ' || *s == '\t' )
		{
			s++ ;
			continue ;
		}

		if ( isdigit ( *s ) || isalpha ( *s ) )
		{
			while ( isdigit ( *s ) || isalpha ( *s ) )
			{
				*t = *s ;
				s++ ;
				t-- ;
			}
		}

		if ( *s == ')' )
		{
			push ( *s ) ;
			s++ ;
		}

		if ( *s == '*' || *s == '+' || *s == '/' ||
				*s == '%' || *s == '-' || *s == '$' )
		{
			if ( top != -1 )
			{
				opr = pop( ) ;

				while ( priority ( opr ) > priority ( *s ) )
				{
					*t = opr ;
					t-- ;
					opr = pop( ) ;
				}
				push ( opr ) ;
				push ( *s ) ;
			}
			else
				push ( *s ) ;
			s++ ;
		}

		if ( *s == '(' )
		{
			opr = pop( ) ;
			while ( ( opr ) != ')' )
			{
				*t = opr ;
				t-- ;
				opr =  pop ( ) ;
			}
			s++ ;
		}
	}

	while ( top != -1 )
	{
		opr = pop( ) ;
		*t = opr ;
		t-- ;
	}
	t++ ;
}
int infix :: priority ( char c )
{
	if ( c == '$' )
		return 3 ;
	if ( c == '*' || c == '/' || c == '%' )
		return 2 ;
	else
	{
		if ( c == '+' || c == '-' )
			return 1 ;
		else
			return 0 ;
	}
}
void infix :: show( )
{
	while ( *t )
	{
		cout << " " << *t ;
		t++ ;
	}
}

void main( )
{
	char expr[MAX] ;
	infix q ;

	cout << "\nEnter an expression in infix form: " ;
	cin.getline ( expr, MAX ) ;

	q.setexpr( expr ) ;
	q.convert( ) ;

	cout << "The Prefix expression is: " ;
	q.show( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-expression-to-prefix-form/">C++ program to convert an Expression from Infix expression to Prefix form</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-convert-an-expression-from-infix-expression-to-prefix-form/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to convert an Expression from Infix form to Postfix form</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-form-to-postfix-form/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-form-to-postfix-form/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 11:52:45 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[pop]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[infix]]></category>
		<category><![CDATA[download]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1255</guid>

					<description><![CDATA[<p>#include #include #include const int MAX = 50 ; class infix { private : char target[MAX], stack[MAX] ; char *s, *t ; int top ; public : infix( ) ; void setexpr ( char *str ) ; void push ( char c ) ; char pop( ) ; void convert( ) ; int priority (</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-form-to-postfix-form/">C++ program to convert an Expression from Infix form to Postfix form</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
#include <string.h>
#include <ctype.h>
const int MAX = 50 ;
class infix
{
	private :
		char target[MAX], stack[MAX] ;
		char *s, *t ;
		int top ;
	public :
		infix( ) ;
		void setexpr ( char *str ) ;
		void push ( char c ) ;
		char pop( ) ;
		void convert( ) ;
		int priority ( char c ) ;
		void show( ) ;
} ;
infix :: infix( )
{
	top = -1 ;
	strcpy ( target, "" ) ;
	strcpy ( stack, "" ) ;
	t = target ;
	s = ""  ;
}
void infix :: setexpr ( char *str )
{
	s = str ;
}
void infix :: push ( char c )
{
	if ( top == MAX )
		cout << "\nStack is full\n" ;
	else
	{
		top++ ;
		stack[top] = c ;
	}
}
char infix :: pop( )
{
	if ( top == -1 )
	{
		cout << "\nStack is empty\n" ;
		return -1 ;
	}
	else
	{
		char item = stack[top] ;
		top-- ;
		return item ;
	}
}
void infix :: convert( )
{
	while ( *s )
	{
		if ( *s == ' ' || *s == '\t' )
		{
			s++ ;
			continue ;
		}
		if ( isdigit ( *s ) || isalpha ( *s ) )
		{
			while ( isdigit ( *s ) || isalpha ( *s ) )
			{
				*t = *s ;
				s++ ;
				t++ ;
			}
		}
		if ( *s == '(' )
		{
			push ( *s ) ;
			s++ ;
		}
		char opr ;
		if ( *s == '*' || *s == '+' || *s == '/' || *s == '%' || *s == '-' || *s == '$' )
		{
			if ( top != -1 )
			{
				opr = pop( ) ;
				while ( priority ( opr ) >= priority ( *s ) )
				{
					*t = opr ;
					t++ ;
					opr = pop( ) ;
				}
				push ( opr ) ;
				push ( *s ) ;
			}
			else
				push ( *s ) ;
			s++ ;
		}
		if ( *s == ')' )
		{
			opr = pop( ) ;
			while ( ( opr ) != '(' )
			{
				*t = opr ;
				t++ ;
				opr =  pop( ) ;
			}
			s++ ;
		}
	}
	while ( top != -1 )
	{
		char opr = pop( ) ;
		*t = opr ;
		t++ ;
	}
	*t = '\0' ;
}
int infix :: priority ( char c )
{
	if ( c == '$' )
		return 3 ;
	if ( c == '*' || c == '/' || c == '%' )
		return 2 ;
	else
	{
		if ( c == '+' || c == '-' )
			return 1 ;
		else
			return 0 ;
	}
}
void infix :: show( )
{
	cout << target ;
}
void main( )
{
	char expr[MAX] ;
	infix q ;

	cout << "\nEnter an expression in infix form: " ;
	cin.getline ( expr, MAX ) ;

	q.setexpr ( expr ) ;
	q.convert( ) ;

	cout << "\nThe postfix expression is: " ;
	q.show( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-convert-an-expression-from-infix-form-to-postfix-form/">C++ program to convert an Expression from Infix form to Postfix form</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-convert-an-expression-from-infix-form-to-postfix-form/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
	</channel>
</rss>
