answersLogoWhite

0


Best Answer

#include<stdio.h>

int a[10],i=(-1),st=(-1);

void push();

void pop();

void isfull();

void isnull();

void display();

main()

{

int st=(-1);

int a[10],n,ch,i=(-1);

char choice='Y';

while(choice=='Y' choice=='y')

{

printf(" 1.PUSH\n 2.POP\n 3.IS FULL\n 4.IS NULL\n 5.DISPLAY\n");

printf("Enter your choice :");

scanf("%d",&ch);

switch(ch)

{

case 1:

push();

break;

case 2:

pop();

break;

case 3:

isfull();

break;

case 4:

isnull();

break;

case 5:display();

break;

default:

printf("you have entered a wrong entry.");

}

printf("Do you want to continue?");

scanf(" %c",&choice);

}

}

void push()

{

if(st==(-1))

printf("The stack is empty.");

i=i+1;

if(i>=10)

printf("The stack is full.");

else

{

printf("Enter a number :");

scanf("%d",&a[i]);

st=st+1;

}

}

void pop()

{

if(st==(-1))

printf("The stack is empty. UNDERFLOW condition");

if(st>(-1))

{

printf("The deleted element is :%d",a[i]);

i=i-1;

st=st-1;

}

}

void isfull()

{

if(st<9)

printf("The stack is not full\n");

if(st>=9)

printf("The stack is full");

}

void isnull()

{

if(st==(-1))

printf("The stack is empty");

if(st>(-1))

printf("The stack is not empty");

}

void display()

{

int z;

if (st==(-1))

printf("The stack is empty.");

else

printf("The elements present in the array are :");

for(z=0;z<=i;z++)

printf(" %d",a[z]);

printf("\n");

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Menu driven program that implements singly linked list for the following operations?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Menu driven program in c programming?

You can find the source code of the menu driven graphics program here: http://www.start2code.com/Cresources/menu-driven-graphics-program-c.html


What is the meaning of the menu driven program?

Menu-driven simply means you execute the application's commands by selecting them from a menu, as opposed to command-driven whereby you enter (type) the commands manually.


What are the advantage and disadvantage of organizing an event?

There are many advantages of event driven programming. This type of programming is the simplest and flexible forms of programming languages. This means the programmer has more control over the program when the user does something. Also, making an event driven program is easy. There are only a few disadvantages that come with the event driven programming. Firstly, sometimes classes are not often reusable and are hard to carry out in other applications. It is also very complex and hard to master.


What does it mean that VBA is objcet and event driven programming language?

Object driven programming languages are all based around objects on a 'form' or a 'room'. For example the program will be ran around buttons or other controls. For example if a user clicks a button a set of defined steps will occur. Event driven is similar. For example if this occurs then do this. For example while counter = 1 do .... Basically it is more simple for novice programmers to use and get their head around.


Explain event driven programming?

Let's say, I were to go create a button object for the program user to click on...; the button text might say. [Click here] ...or,... [Click here to see Help] ...or,... [Click here to sort list] -etc. At first, the button would just simply sit there; and, therefore, the program would take no further action; except to wait for an 'event' to happen. Whenever the user of my program clicks on that button; then, the button 'click event' will get triggered. The users click might trigger off some other code to start working...such as, when the button is clicked on do this/or, do that...display a text message/or, sort list/ -etc. Each seperate object has it's own list of possible events. For example, a button can have the following list of events... button.Focus() button.Click() button.DoubleClick() -etc. so, the program waits to see what type of event is happenning, first ...and, when a certain type of event does, eventually, occur...then, this leads to more programming code getting executed. This is how OOP/Object Oriented Programming languages...programming using objects/objects that are 'event driven' works.

Related questions

Menu driven program in c programming?

You can find the source code of the menu driven graphics program here: http://www.start2code.com/Cresources/menu-driven-graphics-program-c.html


Is operating system an event driven program?

yes


Write c program of menu driven by calculator?

dcdfsadf


What is meant by event driven?

event driven programs do not have a specific pathway in which the programs instructions are executed. different parts of the program are evoked by events that take place during the running of the program.


What is the meaning of the menu driven program?

Menu-driven simply means you execute the application's commands by selecting them from a menu, as opposed to command-driven whereby you enter (type) the commands manually.


How event driven program is different from other program?

In normal (ie imperative) programming, you define a set of operations to be performed sequentially, from start to finish in one go. In event driven programming, you define a series of "callback" functions, which are then called by whatever runtime system you may be using, in response to the actions of the user, or some other agent. Each function is associated with an action (eg the user pressing a button or clicking an icon), and is called by the system whenever the user performs that action.


Is center lathe a machine tool?

Yes. A machine tool is a power driven machine that is a tool in itself which performs machining operations.


What does it mean to wear your pants below your buttcheeks?

It means you are a culture-driven, following idiot


Why are hills good places to rear sheeps?

Often the hills are too steep and rugged for machinery like tractors and implements to be driven on without risk of flipping over. Hills grow grass, which feeds the sheep.


What is a spud barge?

A spud barge has steel pilings which are driven in to the river bed to allow them to stay stationary and allow them to support construction operations.


List and briefly define three techniques for IO operations?

Blocking IO: The program will pause and wait until the IO operation is complete before resuming. This technique can lead to inefficiency if there are multiple IO operations. Non-blocking IO: The program continues to run while waiting for the IO operation to complete. This allows for better efficiency when handling multiple IO operations simultaneously. Asynchronous IO: The program initiates the IO operation and continues executing, without waiting for the operation to complete. A callback function is usually provided to handle the result once it is available. This allows for better performance in handling large numbers of IO operations.


How does a datavision program work?

Data Vision is an accounting package software. It helps one in managing their sales, purchases, inventory, and production. The program works in a menu-driven format.