Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int Insert_Lastposition (int b[], int nn, int vv);
- void Edit(int b[], int pp, int vv);
- void Display_Array(int b[],int k);
- int main()
- {
- int a[100],n,i,c,b=1,p,v;
- printf("\n Enter how many values \n");
- scanf("%d",&n);
- printf("\n Enter values\n");
- for(i=1;i<=n;i++)
- scanf("%d",&a[i]);
- while(b)
- {
- printf("\n------Menu------\n");
- printf("\n Press 0 for Quit \n");
- printf("\n Press 1 for display \n");
- printf("\n Press 2 for insertion at last pointer \n");
- printf("\n Press 3 for insertion at specific \n");
- printf("\n Press 4 for Delete from specific position \n");
- printf("\n Press 5 for Linear Search \n");
- printf("\n Press 6 for Bubble Sort \n");
- printf("\n Press 7 for Bainary Search \n");
- printf("\n Press 8 For Edit \n");
- printf("\n Enter your Choice \n");
- scanf("%d",&c);
- switch(c)
- {
- case 0:
- b=0;
- break;
- default:printf("\n Wrong Choice ");
- break;
- case 1:
- printf("\n Choice=Display \n");
- if(n!=0)
- Display_Array(a,n);
- else
- printf("\n No Data to Display \n");
- break;
- case 2:
- printf("\n Choice=Insert at last position \n");
- printf("Enter new value\n ");
- scanf("%d", & v);
- n= Insert_Lastposition(a,n,v);
- break;
- case 8:
- printf("\n Choice =Edit\n");
- if(n!=0)
- {
- printf("\n Enter Now value \n");
- scanf("%d" ,&v);
- M:printf("Enter Position between %d to %d\n",1,n);
- scanf("%d",&p);
- if(p>=1 &&p<=n)
- Edit(a,p,v);
- else
- {
- printf("\n Worng Position \n");
- goto M;
- }
- }
- }
- }
- }
- void Display_Array(int b[],int k)
- {
- int j;
- printf("\n The display are: \n");
- for(j=1;j<=k;j++)
- printf("%d\n",b[j]);
- }
- void Edit(int b[], int pp, int vv)
- {
- b[pp]=vv;
- printf("\n Edited Successfully");
- }
- int Insert_Lastposition (int b[], int nn, int vv)
- {
- b[nn+1]=vv;
- printf("\n Inserted successfully \n\n");
- return nn+1;
- }
Advertisement
Add Comment
Please, Sign In to add comment