谁能帮我编一个简单的C语言程序啊?

来源:百度知道 编辑:UC知道 时间:2024/04/29 15:32:06
利用至少五个常用函数编写一段程序,使用的函数不限,完成的功能也不限
谢谢

正好做了要交作业的

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
typedef int ElemType;

typedef struct LNode {
ElemType date;
struct LNode *next;
}linklist,*link;

/*构造链表*//////////////////////////////////////
void IinitList(link &L)
{
if(L)delete L;
L= (link)malloc(sizeof(LNode)) ;
if (!L) exit(1);
L->next=NULL;
cout<<"链表已经建立\n";
}
//////////////////////////////////////////////////////
// /*删除结点*/// //////////////////////////////////////////////
int listdelete(link &L,int i,ElemType &e)
{
link p,q; int j;
p=L;j=0;
while(p->next&&j<i-1)
{
p=p->next;++j;
}

q=p->next;
p->next=q->next;
e=q->date;free(q);
cout<<"结点已经删除\n";
return 1;
}
////////////////////////////////////////////// /////////
// /*插入结点*/