I need to solve this question rapidly
please I need you help>>>>>>>>>>

Write a C program to create and manipulate a one dimensional array (list) of up to a hundred sorted ( ascending order) numbers by using functions to insert, remove, or print elements as follows:
- Function insert : will search for the appropriate position of a given element and if the element is already in the list will display an error message. If not, the function will shift all the elements starting from the position of the element to the right of the array and then insert the element into that position.
- Function remove: will search for the element to be removed and if not found will display an error message. If the element exists, the function will remove it and shift all the elements that follow it to the left of the array.
- Function print: will print the elements that exist in the array at that point.
Your program should display a menu to the user that allows him/her to insert, remove, or print as many elements as they want until they want to stop. If an element is inserted into an already full list, an error message should be displayed. The array (list) at the beginning should be empty.

Example of a sample run:
Enter your choice: 1) insert 2) remove 3) print 4) exit
2
List is empty, No change
Enter your choice: 1) insert 2) remove 3) print 4) exit
1
Enter element to insert
6
Element 6 is inserted
Enter your choice: 1) insert 2) remove 3) print 4) exit
1
Enter element to insert
9
Element 9 is inserted
Enter your choice: 1) insert 2) remove 3) print 4) exit
1
Enter element to insert
7
Element 7 is inserted
Enter your choice: 1) insert 2) remove 3) print 4) exit
2
Enter element to remove
112
Element 112 does not exist, No change
Enter your choice: 1) insert 2) remove 3) print 4) exit
2
Enter element to remove
6
Element 6 is removed
Enter your choice: 1) insert 2) remove 3) print 4) exit
3
Elements in list are:
7
9
Enter your choice: 1) insert 2) remove 3) print 4) exit
1
Enter element to insert
7
Element 7 already exists, No change
Enter your choice: 1) insert 2) remove 3) print 4) exit
4
Goodbye

Thanks>>>>>>>

Recommended Answers

All 2 Replies

That's not help. That would be doing your homework for you.
Read the forum rules.
You need to show effort, and what better way than posting the code that you have tried so far?

Im sorry but I forget to show my work
>>>>>>>>>>>>>>

#include <stdio.h>
#define size 100
void insert (int[],int);
void remove (int[],int);
void print (int[],int);
int main()
{
 int choice,i;
 int list[size];
 while(i!=4)
 {
     printf("Enter your choice\n\n");
     printf("1)Insret\n2)Remove\n3)Print\n4)Exit\n\n");
     scanf("%d",&choice);

     switch(choice)
     {
         case 1:
         insert(list,size);
         break;
         case 2:
         case 3:
         default:
         printf("Have a nice day\n");
         break;
     }
 }
 return 0;

}

void insert (int a[],int s)
{
    int i,j,temp;
    printf("Enter element to insert\n");
    for(i=0;i<size-1;i++)
    {
        scanf("%d",&a[i]);
        break;
    }
    printf("Element %d is inserted\n",a[i]);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.