<?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>stack imlementation | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/stack-imlementation/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Wed, 10 Mar 2010 17:34:23 +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++ programs to implement the Stack ADT using a singly linked list</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-stack-adt-using-a-singly-linked-list/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-stack-adt-using-a-singly-linked-list/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Wed, 10 Mar 2010 17:34:23 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[stack imlementation]]></category>
		<category><![CDATA[linked list]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1011</guid>

					<description><![CDATA[<p>while(temp->next != NULL)<br />
                          temp=temp->next;<br />
                     temp1=new node;<br />
                     temp->next=temp1;<br />
                     temp1->next=NULL;<br />
                     temp1->data=x;</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-stack-adt-using-a-singly-linked-list/">C++ programs to implement the Stack ADT using a singly linked list</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write C++ programs to implement the Stack ADT using a singly linkedlist*/</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
class node
{
      public:
             class node *next;
             int data;
};

class stack : public node
{
            node *head;
            int tos;
      public:
             stack()
               {
                    tos=-1;
               }
             void push(int x)
              {        
              	if (tos < 0 )
                  {
                     head =new node;
                     head->next=NULL;
                     head->data=x;
                     tos ++;
                   }
             else
                  {
                   	 node *temp,*temp1;
                     temp=head;
                     if(tos >= 4)
                     	{
                      		cout <<"stack over flow";
                        	return;
                         }
                     tos++;
                     while(temp->next != NULL)
                          temp=temp->next;
                     temp1=new node;
                     temp->next=temp1;
                     temp1->next=NULL;
                     temp1->data=x;
                   }
                }
             void display()
               {
                  node *temp;
                  temp=head;
                  if (tos < 0)
                    {
                        cout <<" stack under flow";
                        return;
                     }
                  while(temp != NULL)
                     {
                        cout <<temp->data<< " ";
                        temp=temp->next;
                     }
               }
              void pop()
                {
                   node *temp;
                   temp=head;
                   if( tos < 0 )
                    {
                       cout <<"stack under flow";
                       return;
                    }                  
                    tos--;
                    while(temp->next->next!=NULL)
                      {
                     	temp=temp->next;
                       }
                    temp->next=NULL;
                 }
};
main()
{
	stack s1;
	int ch;
	while(1)
	{
	cout <<"\n1.PUSH\n2.POP\n3.DISPLAY\n4.EXIT\n enter ur choice:";
	cin >> ch;
	switch(ch)
	      {
		case 1:   cout <<"\n enter a element";
                 		  cin >> ch;
                 		  s1.push(ch);
                 		  break;
		case 2:   s1.pop();break;
		



case 3:   s1.display();
                 		   break;
		case 4:   exit(0);
		}
     }
return (0);
}
</pre>
<p><strong>OUTPUT</strong><br />
1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:1<br />
 enter a element23</p>
<p>1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:1<br />
 enter a element67</p>
<p>1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:3<br />
23 67<br />
1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:2</p>
<p>1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:3<br />
23<br />
1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:2</p>
<p>1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:2<br />
stack under flow<br />
1.PUSH  2.POP  3.DISPLAY 4.EXIT<br />
enter ru choice:4</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-stack-adt-using-a-singly-linked-list/">C++ programs to implement the Stack ADT using a singly linked list</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-programs-to-implement-the-stack-adt-using-a-singly-linked-list/feed/</wfw:commentRss>
			<slash:comments>20</slash:comments>
		
		
			</item>
		<item>
		<title>Java program that implements stack ADT</title>
		<link>https://studentprojects.in/software-development/java/java-programs/advanced/java-program-that-implements-stack-adt/</link>
					<comments>https://studentprojects.in/software-development/java/java-programs/advanced/java-program-that-implements-stack-adt/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 02 Oct 2009 18:13:41 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[stack]]></category>
		<category><![CDATA[ADT]]></category>
		<category><![CDATA[Data structure in java]]></category>
		<category><![CDATA[stack imlementation]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=869</guid>

					<description><![CDATA[<p>public stack(int s)<br />
	{<br />
		size=s>0?s:10;<br />
		top=-1;<br />
		elements=(E[])new Object[size];<br />
	}</p>
<p>The post <a href="https://studentprojects.in/software-development/java/java-programs/advanced/java-program-that-implements-stack-adt/">Java program that implements stack ADT</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="java" escaped="true" line="1">
import java.util.Scanner;
class stack<E>
{
	private final int size;
	private int top;
	private E[] elements;
	public stack()
	{
		this(10);
	}
	public stack(int s)
	{
		size=s>0?s:10;
		top=-1;
		elements=(E[])new Object[size];
	}
	public void push(E x)
	{
		if(top==size-1)
			System.out.println("Overflow");
		elements[++top]=x;
	}
	public E pop()
	{
		if(top==-1)
			System.out.println("Underflow");
		return elements[top--]; 
	}
	public void display()
	{
		if(top==-1)
			System.out.println("Stack is empty");
		else
		{
			for(int i=0;i<top;i++)
				System.out.println(elements[i]);
		}
	}
}

public class stacktest
{
	public static void main(String[] args)
	{
		int ch,ch1;
		stack<Double>d_stack;
		d_stack=new stack<Double>(5);
		Scanner input=new Scanner(System.in);
		do
		{
			System.out.println("Menu is as follows:");
			System.out.println("1.Push\n2.Pop\n3.Display\n4.Exit");
			System.out.println("Enter your choice:");
			ch=input.nextInt();
			switch(ch)
			{
				case 1:	System.out.println("Enter element to push:");
						double item=input.nextInt();
						d_stack.push(item);
						break;
				case 2:	double item1=d_stack.pop();
						System.out.println("Popped item:"+item1);
						break;
				case 3:	d_stack.display();
						break;
				default:	break;
			}
		}while(ch!=4);		
	}
}

</pre>
<p>Output:<br />
Menu is as follows:<br />
1.Push<br />
2.Pop<br />
3.Display<br />
4.Exit<br />
Enter ur choice:1<br />
Enter element to push :12</p>
<p>Menu is as follows:<br />
1.Push<br />
2.Pop<br />
3.Display<br />
4.Exit<br />
Enter ur choice:1<br />
Enter element to push:13</p>
<p>Menu is as follows:<br />
1.Push<br />
2.Pop<br />
3.Display<br />
4.Exit<br />
Enter ur choice:3<br />
12.0<br />
13.0</p>
<p>Menu is as follows:<br />
1.Push<br />
2.Pop<br />
3.Display<br />
4.Exit<br />
Enter ur choice:2<br />
Popped item:13.0</p>
<p>Menu is as follows:<br />
1.Push<br />
2.Pop<br />
3.Display<br />
4.Exit<br />
Enter ur choice:2<br />
Popped item:12.0</p>
<p>Menu is as follows:<br />
1.Push<br />
2.Pop<br />
3.Display<br />
4.Exit<br />
Enter ur choice:3<br />
Stack is empty</p><p>The post <a href="https://studentprojects.in/software-development/java/java-programs/advanced/java-program-that-implements-stack-adt/">Java program that implements stack ADT</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/java/java-programs/advanced/java-program-that-implements-stack-adt/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
