#include
using namespace std;
struct link
{
int v;
struct link *n;
} *st,*ed;
void add(struct link *a,struct link *p);
struct link * createnew(int x)
{
struct link *j;
j=new struct link;
j->n=NULL;
j->v=x;
return j;
};
int main()
{
struct link *p, *a;
int x;
for(int i=0;;i++)
{
p=a;
cout<<“Enter Value:”;
cin>>x;
if(x==0)
break;
a=createnew(x);
add(a,p);
}
p=st;
for(int i=0;;i++)
{
cout<v<<endl;
p=p->n;
if(p==NULL)
break;
}
}
void add(struct link *a,struct link *p)
{
if(st==NULL)
{
st=a;
}
else
p->n=a;
}
lol…
-
Please include link of solution if you are facing problem in converting it to proper format here…
-
Please include problem link too…
-
I have a doubt… You want to understand problem or code directly…
-
Have you tried this problem by yourself? I am not seeing any attempt from your side…
Edit: Thanks @vijju123 for formatting it properly…
i want to understand the code.the problem is of a simple queue.