Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int n=0,r=0,f=0,ar[10];
- void cre()
- {
- if((f==1 && r==n) || f==r+1)
- {
- printf("Over\n");
- }
- else
- {
- int e;
- scanf("%d",&e);
- if(r==n)
- {
- r=1;
- ar[r] = e;
- }
- else if(f==0)
- {
- r++;
- f++;
- ar[r] = e;
- }
- else
- {
- r++;
- ar[r] = e;
- }
- }
- }
- void delet()
- {
- if(f==0 && r==0)
- {
- printf("Unn\n");
- }
- else
- {
- printf("D is %d",ar[f]);
- ar[f] = 0;
- if(f==r)
- {
- r=0;
- f=0;
- }
- else if(f==n)
- {
- f=1;
- }
- else
- {
- f++;
- }
- }
- }
- void dis()
- {
- if(f==0 && r==0) printf("Empty.\n");
- else
- {
- int i;
- for(i=1;i<=n;i++)
- {
- printf("%d ",ar[i]);
- }
- printf("\n%d %d\n",ar[f],ar[r]);
- printf("\n");
- }
- }
- int main()
- {
- scanf("%d",&n);
- while(1)
- {
- printf("\n1.I 2.Del 3.Diss\n");
- int x;
- scanf("%d",&x);
- switch(x)
- {
- case 1:
- {
- cre();
- break;
- }
- case 2:
- {
- delet();
- break;
- }
- case 3:
- {
- dis();
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment