DFS :: STACK

#include<iostream.h>
#include<conio.h>

main()
{
int a[10],i,j;
char ans;
clrscr();

i=0;
do
{
cout<<“Enter the value:”;
cin>>a[i];
i++;
cout<<“Do U wanna enter the another value?…”;
cin>>ans;

if(i>=10)
{
cout<<“Overvlow…”;
break;
}

}while(ans==’y’||ans==’Y’);
for(j=0;j<i;j++)
{
cout<<a[j];
}
j=i;

do
{
cout<<“\ndeleted value:”<<a[j];
a[j]=0;
j–;

if(j<=0)
{
cout<<“\nUnder Flow”;
break;
}

cout<<“\nDo U wanna delete another value?…”;
cin>>ans;
}while(ans==’y’||ans==’Y’);
for(j=0;j<i;j++)
{
cout<<a[j];
}
getch();

}

Share

About the Author

Akash Padhiyar

Visit Website

There are no comments yet, add one below.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.