Computers & Internet Logo

Related Topics:

Posted on Dec 05, 2008

Source code for stack using arrays in c++

I want a stack program using arrays
with menu options
push,pop,display ,exit

  • 1 more comment 
  • yhael Feb 27, 2009

    i want a stack program using arrays
    with menu options
    push,pop,display ,exit

  • Anonymous May 11, 2010

    Which language are we dealing with here?

  • Dave Harris
    Dave Harris May 11, 2010

    What is it you're trying to stack?

    What do you want to display things on?

    Is this a homework/coursework assignment ;-?


×

5 Answers

karthik1991m

Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Corporal:

An expert that has over 10 points.

Mayor:

An expert whose answer got voted for 2 times.

  • Contributor 8 Answers
  • Posted on Sep 01, 2010
karthik1991m
Contributor
Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Corporal:

An expert that has over 10 points.

Mayor:

An expert whose answer got voted for 2 times.

Joined: Sep 01, 2010
Answers
8
Questions
0
Helped
4797
Points
26

Stack in c using arrays
/* Program of stack using array*/
#include

Anonymous

Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Mayor:

An expert whose answer got voted for 2 times.

  • Contributor 1 Answer
  • Posted on Apr 26, 2010
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Mayor:

An expert whose answer got voted for 2 times.

Joined: Apr 26, 2010
Answers
1
Questions
0
Helped
2808
Points
5

Make a stack program C that
CreateStack
FullStack
EmptyStack
Push
Pop
Peek

Ad

Anonymous

Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Mayor:

An expert whose answer got voted for 2 times.

  • Contributor 1 Answer
  • Posted on Jan 29, 2011
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Mayor:

An expert whose answer got voted for 2 times.

Joined: Jan 29, 2011
Answers
1
Questions
0
Helped
2808
Points
4

Visit

http://www.cppforschool.com/tutorial/dynamic-stack.html

Anonymous

Level 1:

An expert who has achieved level 1.

  • Contributor 1 Answer
  • Posted on Aug 28, 2012
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

Joined: Aug 28, 2012
Answers
1
Questions
0
Helped
2808
Points
0

I want to know push and pop

Anonymous

Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

  • Contributor 1 Answer
  • Posted on Nov 13, 2011
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Joined: Nov 13, 2011
Answers
1
Questions
0
Helped
2808
Points
1

/**************** CProgram For Impelmetation Of Stack ********************/#define MAXSIZE 10struct st{int top;int stack[MAXSIZE];};struct st s;int empty(void);int full(void);void push(void);void pop(void);void display(void);void main(){char ans;int ch;do{clrscr();printf("********StackProgram**********\n");printf("1.PUSH\n");printf("2.POP\n");printf("3.DISPLAY\n");printf("4.QUIT\n");printf("EnterYour Choice : ");scanf("%d",&ch);switch(ch){case 1:push();break;case 2:pop();break;case 3:display();break;case 4:exit(1);break;default:printf("INVALIDCHOICE!!!!!!!!!!!!!!!!\n");break;}printf("Want ToGo To The Main Menu[y/n]");flushall();ans = getch();}while(ans == 'y' ans== 'Y');printf("\nPressAny Key To Exit");getch();}int full(void){if (s.top == MAXSIZE)return(1);elsereturn(0);}int empty(void){if (s.top == 0)return(1);elsereturn(0);}void push(void){char ch;int x;do{if(full() == 1){printf("\nStackFull\n");break;}else{s.top = s.top + 1;printf("\nEnterAn Element To Be Pushed: ");scanf("%d",&x);s.stack[s.top] = x;}printf("\nDo YouWant To Push More Elements[y/n]");flushall();ch = getch();}while(ch == 'y' ch =='Y');}void pop(void){char ch;do{if(empty() == 1){printf("\nStackEmpty\n");break;}else{printf("\n%d hasbeen popped !",s.stack[s.top]);s.top = s.top - 1;}printf("\nDo youWant To Pop Out More?[y/n]");flushall();ch = getch();}while(ch == 'Y' ch =='y');}void display(void){int i;clrscr();if(empty() == 1)printf("\nStackEmpty!!!");else{printf("DisplayingStack............\n");for(i = s.top;i>0;i--)printf("%d",s.stack[i]);}}/**************OUTPUT *********************StackProgram**********1. PUSH2. POP3. DISPLAY4. QUITEnter Your Choice : 1Enter An Element ToBe Pushed : 1Do YOu Want To PushMore Elements [y\n] yEnter An Element ToBe Pushed : 2Do YOu Want To PushMore Elements [y\n] yEnter An Element ToBe Pushed : 3Do YOu Want To PushMore Elements [y\n] yEnter An Element ToBe Pushed : 4Do YOu Want To PushMore Elements [y\n] yEnter An Element ToBe Pushed : 5Do YOu Want To PushMore Elements [y\n] nWant To Go Main Menu?[y\n] y********StackProgram**********1. PUSH2. POP3. DISPLAY4. QUITEnter Your Choice : 3DisplayingStack......54321Want To Go Main Menu?[y\n] y********StackProgram**********1. PUSH2. POP3. DISPLAY4. QUITEnter Your Choice : 25 Has Been Popped!Do You Want To PopMore? [y\n] y4 Has Been Popped!Do You Want To PopMore? [y\n] nWant To Go Main Menu?[y\n] y********StackProgram**********1. PUSH2. POP3. DISPLAY4. QUITEnter Your Choice : 3DisplayingStack.........321Want To Go Main Menu?[y\n] y********StackProgram**********1. PUSH2. POP3. DISPLAY4. QUITEnter Your Choice : 4*/

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

0helpful
1answer

What do the PUSHAD instructions accomplish?

According to several sources including online college level assembly language courses (check assembly language books or google it too)
It pushes all of the 32-bit general-purpose registers on the stack. According to Alpheus's post at:
http://stackoverflow.com/questions/9313098/pushfd-and-pushad-whats-the-point

it states:

The PUSHAD instruction always pushes all 8 general purpose registers onto the stack. A single PUSHAD instruction is equivilent to writing: Push EAX Push ECX Push EDX Push EBX Push ESP Push EBP Push ESI Push EDI POPAD pops the values back off the stack in reverse order, thus restoring all the register values.
PUSHAD and POPAD are useful for performing a easy save and restore of the general purpose registers without having to PUSH and POP every individual register in turn.
Similarly, PUSHFD and POPFD are used to save and restore the EFLAGS register. Although not really used that much in ordinary programs, the instructions are useful when (for example) a process context switch is performed (or anywhere else where the value of the flags register must be restored).
how does the pushfd operation push a value such as 00000A46 to the stack?
It's just how the data is interpreted. The EFLAGS register is a set of 32 bits. If you divide the bits up into 8 groups of 4 (8*4=32), you can map each 4 bit chunk to a hexadecimal character (0..9,A-F). Likewise, you can convert the hexadecimal values back to a set of bits:
00000A46 = 0000(0) 0000(0) 0000(0) 0000(0) 0000(0) 1010(A) 0100(4) 0110(6)
These are the values of the bits that were stored in the EFLAGS register.






Also, see this site for some question and snwer terms:

https://quizlet.com/30362170/assembly-quiz-5-flash-cards/
2helpful
1answer

Samsung tv (EURO MULTI) sarvice code

Hello
These are the service modes for Samsung. Check it with.
[1]
Turn on the TV on and select the input that you want to adjust.
# Turn the display off
In quick sequence on the remote press:
{MUTE} {1} {8} {2} {POWER} buttons.

# The TV will turn On with the Service Menu displayed.
ADJUSTMENT - TEST PATTERN - SET OPTION BYTE - FACTORY RESET

# Select the function and use the {VOL+} button to enter.
# Save settings and exit by pushing {MUTE} twice then {POWER}.
[2]
With the TV in standby, press the {INFO} {MENU} {MUTE} {POWER} buttons on the remote.
The TV will turn On with the Service Menu displayed.
Press the {POWER} button to exit the Service Menu.
[3]
With the TV in standby, press the
{DISPLAY} {P.STD} {MUTE} {POWER} on the remote.
The TV will turn On with the Service Menu displayed.
Use the {CH+} {CH -} buttons to select items.
Use the {VOL+} {VOL -} buttons to adjust.
Press the {POWER} button to exit the Service Menu

7helpful
2answers

I can not get the auxiliary to display on my deck, How do you get the auxiliary to display?

In standby mode press Menu botton at least one second, "MENU" is displayed, with the control knob push towards FM or AM and look for "AUX OFF" item, then push toward > to select "AUX ON1", to exit press Menu botton. After this procedure the auxiliary input should be available as a sound source.
0helpful
1answer

Black and white tv

Hello
Your RCA, system setup has changed I thinks.To change this you have to go to the Menu option surf for system settings, and change the system reception to "AUTO".


Setup

The Setup menu allows you to access the GUIDE Plus+ system setup information. To access the

Setup option:

1. If the GUIDE Plus+ system isn't on your screen, press GUIDE on your remote control.

2. Press MENU to select the Menu Bar.

3. Use the right arrow to highlight the Setup menu selection.

4. Use the up and down arrows to select Change system settings, Review options, or

View demo.

Change system settings Confirms the settings you completed in the GUIDE Plus+

system setup are correct.

Review options Displays the GUIDE Plus+ system auto display options.

On Automatically displays the GUIDE Plus+ system when you press the ON•OFF

button on the remote control.

Off Disables the GUIDE Plus+ system from being displayed when you press the

ON•OFF button on the remote control.
View demo Runs the GUIDE Plus+ system demonstration

Note: If you have not completed your GUIDE Plus+ system setup, these options will not be available. A
screen will prompt you to complete your setup.

Getting In & Out of the GUIDE Plus+ System

To enter the GUIDE Plus+ system:

• Press GUIDE on the remote.

• Press and hold MENU for 2 seconds on the front panel.

To exit the GUIDE Plus+ system:

• Highlight a program and press OK to exit the GUIDE Plus+ system and tune

to the channel.

• Press GUIDE to exit the GUIDE Plus+ system and tune to the channel

displayed in the video window.

• Press CLEAR to exit the GUIDE Plus+ system and return to the original
channel
OK.

0helpful
1answer

How to convert infix to postfix using stacks in java programming?

u can try the follwing coding
import java.io.*;
import java.util.*;
//begin coding for the stack interface
interface Stack<E>
{
public boolean isEmpty();//tests is current stack is empty. Returns true if so, and false if not.
public E top() throws StackException;//retrieves value at the top of the stack. Stack cannot be empty.
public void push(E value) throws StackException;//pushes a value on the top of the stack.
public void pop() throws StackException;//removes a value from the top of the stack. Stack cannot be empty.
}//terminates coding of Stack interface

//begin coding for the objArrayStack class
class objArrayStack<E> implements Stack<E>
{
//constructor
public objArrayStack()
{
topValue=-1;
}//terminates constructor
public void push(E value)throws StackException
{
if(topValue<ArraySize-1)//currrent stack is not full
{
++topValue;
Info[topValue]=value;
}//terminates if
else //current stack is full
throw new StackException("Error: Overflow");
}//terminates push method
public void pop() throws StackException
{
if(!isEmpty())//current stack is not empty
--topValue;
else //stack is empty
throw new StackException("Error: Underflow");
}//terminates pop method
public boolean isEmpty()
{
return topValue==-1;
}//terminates isEmpty method
public E top() throws StackException
{
if(!isEmpty())//stack is not empty
return (E)Info[topValue];
else //stack is empty
throw new StackException("Error: Underflow");
}//terminates top method
//declare instance variables
final int ArraySize=10;
private Object Info[]=new Object[ArraySize];
private int topValue;

//begins coding for the StackException class
class StackException extends RuntimeException
{
//constructor
public StackException(String str)
{
super(str);
}//terminates text of constructor
}//terminates text of StackException class

//method to convert from infix to postfix notation
public static String InToPost(String infixString)
{
//operator stack initialized
objArrayStack<Character> operatorStack = new objArrayStack<Character>();
//postfix string initialized as empty
String postfixString = " ";
//scan infix string and take appropriate action
for(int index = 0; index < infixString.length(); ++index)
{
char chValue = infixString.charAt(index);
if(chValue == '(')
operatorStack.push('(');
else if(chValue == ')')
{
Character oper = operatorStack.top();
while(!(oper.equals('(')) && !(operatorStack.isEmpty()))
{
postfixString += oper.charValue();
operatorStack.pop();
oper = operatorStack.top();
}//end while loop
operatorStack.pop();
}//end else if
else if(chValue == '+' || chValue == '-')
{
if(operatorStack.isEmpty()) //operatorStack is empty
operatorStack.push(chValue);
else //current operatorStack is not empty
{
Character oper = operatorStack.top();
while(!(operatorStack.isEmpty() || oper.equals(new Character('(')) || oper.equals(new Character(')'))))
{
operatorStack.pop();
postfixString += oper.charValue();
}//ends while loop
operatorStack.push(chValue);
}//end else
}//end else if
else if(chValue == '*' || chValue == '/')
{
if(operatorStack.isEmpty())
operatorStack.push(chValue);
else
{
Character oper = operatorStack.top();
while(!oper.equals(new Character('+')) && !oper.equals(new Character('-')) && !operatorStack.isEmpty())
{
operatorStack.pop();
postfixString += oper.charValue();
}//end while loop
operatorStack.push(chValue);
}//end else
}//end else if
else
postfixString += chValue;
}//end for loop
while(!operatorStack.isEmpty())
{
Character oper = operatorStack.top();
if(!oper.equals(new Character('(')))
{
operatorStack.pop();
postfixString += oper.charValue();
}//end if
}//end while
return postfixString ;
}//terminates text of InToPost method

public static void main(String[]args)
{
objArrayStack mystack = new objArrayStack();
System.out.println("Enter a string");
Scanner scan = new Scanner(System.in);
scan.nextLine();
String str = scan.nextLine();
InToPost(str);
}//terminates text of main method
}//terminates text of objArrayStack class
0helpful
1answer

What problems come in project of library management

stack mismatch, over flow, memory dispatch, dynamic array alloaction, pointer conversion, type mismatch are some of the problem u experience in all projects
0helpful
1answer

How to program pip on my vizio

PIP (Picture-in-Picture)
Picture-in-Picture is a feature which allows you to watch two different signal inputs simultaneously, when
selected.
Press menu, go to set up (the wrench icon). Drop down one to the button and highlight the option.
Press the button to activate the PIP feature, which will bring up a display showing Style.
Press either the or button to select it to be either PIP, POP or OFF.
Press either the MENU key to return to the previous menu display or the EXIT key to return to your
program if task has been completed.
If PIP is selected, then you will have the options of selecting the Input (Refer to PIP mode on page 60 of
this manual; for different combinations), Size (The size of the little box to watch the second signal) and
Position (Where you want to place the little box with the second signal).
If POP (Regularly called Picture-by-Picture) is selected, you will only have the option to select the Input
as the screen will display the two different signals side by side; each one occupying half of the screen.
Using the AUDIO key allows you to select which audio
0helpful
1answer

Source code of a program

import java.util.*;
public class StringReverse {
  public static void main(String[] argv) {
    //+
    String s = "Support Tech Problem";

    // Put it in the stack frontwards
    Stack myStack = new Stack();
    StringTokenizer st = new StringTokenizer(s);
    while (st.hasMoreTokens()) myStack.push(st.nextElement());

    // Print the stack backwards
    System.out.print('"' + s + '"' + " backwards by word is:\n\t\"");
    while (!myStack.empty()) { 
      System.out.print(myStack.pop());
      System.out.print(' ');
    }
    System.out.println('"');
    //-
  }
}
0helpful
2answers

Stuck in Menu and remote locked out

You may want to change the batteries in the remote and reprogram it. Let me know if that works. kim
Not finding what you are looking for?

2,818 views

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Grand Canyon Tech
Grand Canyon Tech

Level 3 Expert

3867 Answers

Brad Brown

Level 3 Expert

19187 Answers

Cindy Wells

Level 3 Expert

6688 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...