answersLogoWhite

0

How to correct these errors

#include

#include

#include

#include

#include

#define max 100

int stack[max];

int top;

void push(int stack[],int val,int &top);

int pop(int stack[],int top);

void showstack(int stack[],int &top);

void main()

{ clrscr();

int choice,val;

char opt='Y';

top =-1;

clrscr();

do

{ cout<<"\nMain Menu\n";

cout<<"\n 1. ADDITION OF STACK\n";

cout<<"\n 2. DELETION OF STACK\n";

cout<<"\n 3. TRAVERSAL OF STACK\n";

cout<<"\n 4.EXIT\n";

cin>>choice;

switch (choice)

{case 1:do

{cout<<"Enter the value to be ADDED"<

cin>>val;

void push(stack,val,top);/ error that /parameter is declared in body of the function

cout<<"DO YOU WANT to ADD MORE (Y/N):"; /error/ declaration missing;

cin>>opt;

}while(toupper(opt=='Y'));

break;

case 2:opt='Y';

do

{val=pop(stack,top);

if(val!=-1)

cout<<"VALUE DELETED FROM STACK :"<

cout<

cout<<"DO YOU WANT TO CONTINUE:"<

cin>>opt;

}while(toupper(opt=='Y'));

break;

case 3:showstack(stack,top);

break;

case 4:exit(0);

break;

default:cout<<"YOu entered a wrong choice"<

}}while (choice!=4);

getch();

}

void push(int stack[],int val,int &top)

{if (top==max-1)

cout<<"STACK IS FULL"<

else

top=top+1;

stack[top]=val;

}

int pop(int stack[],int top)

{int value;

if(top<0)

{cout<<"STACK IS EMPTY"<

value=-1;

}

else

{value=stack[top];

top=top-1;

}

return(value);

}

void showstack(int stack[],int&top)

{int i;

if(top<0)

{cout<<"STACK IS EMPTY"<

}

i=top;

cout<<"THE VALUES ARE:"<

do

{cout<

i=i-1;

}while(i>=0);

}

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

How do you attach the animated gif image as a background or as a signature in yahoo or gmail?

write your mail on word document. Paste gif picture on it and send it as attachment in your mail


Can you attach an electronic signature to email message?

in yahoo mail yes u can


How to attach a file in Yahoo Mail?

easy copy it and then paste it in the location you want.


How to insert image in Yahoo Mail?

you can either drag and drop it into the email or attach it as a file.


My Yahoo Mail won't attach any file not even small docs it starts the process but never finishes What is wrong?

yahoo mail sucks, they are always having issues, go with gmail


How do you use unlimited space in yahoo mail?

Every email you send and receive through Yahoo mail is stored as long as you like. You can't simply upload files for storage, but if you attach them to an email, they will be stored.


How do you e mail a scanned document?

Well, when you scan a document you should upload it to either a usb device or it would go right on your computer as a file. You attach the scanned document (the file) to the e-mail and send it.


How can you print your project and print from another computer?

go to your email and press compose mail, then attach a file, and attach the document and send it to yourself


How do you e-mail a document made in Microsoft Word?

In your e-mail, pick the option for an attachment. How you specifically do that will depend on your e-mail system, but quite often a paper clip icon is used. Then find your document on your computer and attach it. Then send the e-mail.


How do you change Yahoo mail classic to Yahoo mail?

not open


How do you get a Yahoo mail account?

You can get a Yahoo! Mail at the link below -


What is the name of Yahoo mail mascot?

NAME of yahoo mail mascot IS : Liam