int main()
{
    char ch;
    int i,j,k,l;
    printf("How many data you want to insert?\n\t");
    scanf("%d",&j);
    int arry[j];
    printf("Insert data into the list for the first time.\n");
    for(k=0;k<j;k++)
    {
        printf("Data[%d]--> ",k);
        scanf("%d",&arry[k]);
    }
    printf("Do you want to insert more data ?\n\t Press Y (yes) / N (no)\n");
    ch = getch();
    if( (ch == 'Y') || (ch == 'y') )
    {
        printf("In which location you want to insert ? \n");
        scanf("%d",&i);
        insertdata(arry,i,(j-1));
    }

    printf("Do you want to delete data ?\n\t Press Y (yes) / N (no)\n");
    ch = getch();
    if( (ch == 'Y') || (ch == 'y') )
    {
        printf("which location you want to delete ? \n");
        scanf("%d",&i);
        deletedata(arry,i,(j-1));
    }
    return 0;
}
Example #2
0
main(){

    ROCHA array[10];
    int i=0; //arbitrary, for looping only
    char choice;
    int recordnumber; //itemnumber in the struct array
    //int recordname; //name in struct array
    //int recordqty; //qty in struct array

    while (i<1){
        choice=getch();

        switch(choice){
            case 49:
            printf("Enter record number from 1 to 10: ");
            fflush(stdin);
            scanf("%d",&recordnumber);
            adddata(recordnumber,array);
            printf("\nSuccessfully added.");


            break;

            case 50:
            printf("Enter record number to delete: ");
            fflush(stdin);
            scanf("%d",&recordnumber);
            deletedata(recordnumber,array);
            printf("\nDeleted successfully.");

            break;

            case 51:
            printf("The records:");
            printdata(array);
            break;

            case 52:
            i=1;
            break;

            default:
            printf("Enter a valid choice from 1-4.");
            break;

        }

    }

}