Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<bits/stdc++.h>
- using namespace std;
- struct c {
- int a;
- struct c *k;
- };
- struct c *s=0;
- struct c *p= 0;
- void come(int x){
- struct c *m;
- m = (c*) malloc (sizeof(c));
- m->a=x;
- m->k=0;
- if(s==0 && p==0){s=p=m;}
- else{p->k=m;p=m;}
- }
- void show ()
- {
- struct c *t;
- if(s==0 && p==0){cout << "Line Empty" << endl;}
- else{t=s;while (t!=0){ cout << endl << " " << t->a << endl;
- t=t->k;
- }
- }
- }
- void out (int y){
- struct c *o;
- o=s;
- if(s == 0 && p==0)
- {
- cout << "Empty Line" << endl;
- }
- else{
- s=s->k;
- free(o);
- }
- }
- int main()
- {
- cout << " Make a safe distance bewtten each other" << endl;
- int i,n,j;
- cout << endl << " Total number of people today : ";
- cin >> j;
- for(i=1;i<=j;i++){come(i);}
- show();
- out(1);
- show();
- out(2);
- show();
- out(3);
- show();
- out(4);
- show();
- out(5);
- show();
- out(6);
- show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement