Advertisement
sujonshekh

Database Programming

Jan 30th, 2017
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.10 KB | None | 0 0
  1. #include<stdio.h>
  2. //declaration
  3. void Display(int b[],int k);
  4. void Edit_Array(int b[],int nn,int pp,int vv);
  5.  
  6. int main()
  7. {
  8.  
  9.     int n,a[100],i,c,b=1,p,v;
  10.     printf("\n How many values You want : \n");
  11.     scanf("%d",&n);
  12.     printf("\n Enter Your values : \n");
  13.  
  14.     //loop for array values
  15.  
  16.     for(i=1;i<=n;i++)
  17.     scanf("%d",&a[i]);
  18.  
  19.     //menu while loop start
  20.  
  21.     while(b)
  22.     {
  23.         printf("\n------Menu -----\n");
  24.         printf("\ntpress 0 for Quit\n");
  25.         printf("\npress 1 for Display Your values Items\n");
  26.         printf("\npress 2 for insertion at last position\n");
  27.         printf("\npress 3 for insertion at Specific position\n");
  28.         printf("\npress 4 for deletion at Specific position \n");
  29.         printf("\npress 5 for Linear search\n");
  30.         printf("\npress 6 Bubble sort\n");
  31.         printf("\npress 7 Binary search\n");
  32.         printf("\nPress 8 for Edit Your Values\n");
  33.  
  34.         scanf("%d",&c);
  35.  
  36.         // switch statement for choice Work
  37.         switch(c)
  38.         {
  39.             case 0: b=0;
  40.             break;
  41.             case 1: printf("\n Choise=Display \n");
  42.             if(n!=0)
  43.             Display(a,n);
  44.             else
  45.             printf("\n The Array is Empty \n");
  46.             break;
  47.             case 8:printf("\n Choise =Edit \n");
  48.             M:printf("\n Choise position between %d to %d \n",1,n);
  49.             scanf("%d",&p);
  50.             if(p>=1&&p<=n)
  51.             {
  52.                 printf("Enter value \n");
  53.                 scanf("%d",&v);
  54.                 Edit_Array(a,n,p,v);
  55.             }
  56.             else
  57.             {
  58.                 printf("\n Wrong position you have enter \n");
  59.                 goto M;
  60.             }
  61.             break;
  62.  
  63.  
  64.  
  65.  
  66.             default: printf("\n Wrong choice you have Enter \n");
  67.  
  68.  
  69.         }
  70.  
  71.  
  72.  
  73.     }
  74.  
  75. return 0;
  76. }
  77.  
  78. //defination
  79.  
  80. void Display(int b[],int k)
  81. {
  82.     int j;
  83.     printf("\n The values are \n");
  84.  
  85.     for(j=1;j<=k;j++)
  86.     printf("%d\n",b[j]);
  87. }
  88.  
  89. //Edit_array defination
  90.  
  91. void Edit_Array(int b[],int nn,int pp,int vv)
  92. {
  93.     b[pp]=vv;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement