vrscans插件:C语言,链表帮忙填一下

来源:百度文库 编辑:神马品牌网 时间:2024/05/06 16:23:50
设计一算法:对线性链表进行查找,插入,删除,置逆操作,并输出结果。

#include"stdio.h"
#include"stdlib.h"
typedef struct node{
int data;
struct node *next;
}node;
node *creat(){}

get(node *head,int i){}

void insert(node *head,int i,int x){}

void delete(node *head,int i){}

node *invert(node *head){}

void print(node *head){}

int main(){
node *head;
int i,x,choice;
head=creat();
printf("Please choice the function:\n1.get \n2.insert \n3.delete \n4.invert\n5.Quit the programe.\n");
scanf("%d",&choice);

switch(choice){
case 5:{
printf("Thanks to use!Good bye!");
break;}
case 1:{
printf("please input i\n");
scanf("%d",&i);
get(head,i);
printf("\n");
break;}

case 2:{
printf("please input i and x\n");
scanf("%d,%d",&i,&x);
insert(head,i,x);
print(head);
printf("\n");
break;}

case 3:{
printf("please input i\n");
scanf("%d",&i);
delete(head,i);
print(head);
printf("\n");
break;}

case 4:{
head=invert(head);
print(head);
printf("\n");
break;}

}

}


书本有~

只要是数据结构的书上都应该有这些的实现的吧!