Cursor implementation of c program?

Answer:
#include<stdio.h>
#include<conio.h>
#include"curslist.h"
void main()
{
LIST L=-1;
POSITION P;
int choice,place,x;
clrscr();
printf("\n1.Create\n2.Insert\n3.Delete\n4.MakeEmpty\n5.Display\n6.Find\n7.Exit");
A:
printf("\nEnter ur choice:\t");
scanf("%d",&choice);
switch(choice)
{
case 1:
if(L==-1)
{
InitializeCursor();
L=CursorAlloc();
}
else
printf("\nList is already created");
break;
case 2:
if(L==-1)
printf("\nList is not yet initialized");
else
{
printf("\nWhere u want to insert?");
scanf("%d",&place);
printf("\nEnter the element to insert");
scanf("%d",&x);
Insert(x,place);
}
break;
case 3:
if(L==-1)
printf("\nList is not yet initialized");
else
{
printf("\nWhich element you want to delete?");
scanf("%d",&x);
Delete(x,L);
}
break;
case 4:
if(L==-1)
printf("\nList is not yet initialized");
else
MakeEmpty(L);
break;
case 5:
if(L==-1)
printf("\nList is not yet initialized");
else
Display();
break;
case 6:
if(L==-1)
printf("\nList is not yet initialized");
else
{
printf("\nWhich element you want to search?");
scanf("%d",&x);
P=Find(x,L);
printf("\nThe element is at %d",P);
}
break;
case 7:
exit(0);
default:
printf("\n *******WRONG ENTRY*******");
}
goto A;
}
First answer by ID2017272251. Last edit by ID2017272251. Question popularity: 1 [recommend question].