input the char you want ( a, b ):::
a
input the char you want ( a, b ):::
b
first, add char you want::(e,f,x,y....)
c
d
e
f
g
h
#
second, while char you want to find
b
b is found in this link..
second, while char you want to delete
f
element in the list is:
h
g
e
d
c
a
b
Press any key to continue
//测试结果。。。。。
void main()
{
LNode *head = (LNode *)malloc(sizeof(LNode));
LNode *p = head;
char arg;
char re;
int i;
int LEN = 2;
for( i = 0; i<LEN; i++ ) //先在结构中添入几个数据,为2;
{
LNode *node = (LNode *)malloc(sizeof(LNode));
printf("input the char you want ( a, b )::: \n");
scanf("%c",&node->ch);
p->next = node;
p=node;
getchar();
}
p->next = NULL;
printf("first, add char you want::(e,f,x,y....)\n");
add(&head );
printf("second, while char you want to find\n");
scanf("%c", &arg);
getchar();
re = find( &head, arg );
if( re != arg)
printf(" this arg doesn't exsit...\n");
else
printf("%c is found in this link..\n", arg);
printf("second, while char you want to delete\n");
scanf("%c", &arg);
getchar();
del( &head, arg );
printf("element in the list is: \n");
print( &head );
free(head);
}