c语言中的find函数是什么意思呀?

#include <stdio.h>
#include <string.h>
#define max 20
int last=20;
int node[max]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
int main()
{
int i,a,x,c,p,flag=0,r,s,u,v;
void insert(int p,int x);
void delet(int p);
printf("please enter number:\n1,删除下标为p的节点\n2,在下标为u的节点之前插入v\n3,退出系统\n");
do
{
scanf("%d",&a);
switch(a)
{
case 1:
printf("please enter the x\n");
scanf("%d",&x);
c=find(x);
printf("findresult=%d\n",c);
break;
case 2:
printf("please enter the delete pot p\n");
scanf("%d",&p);
printf("before delete\n");
for(i=0;i<=last-1;i++)
printf("%d ",node[i]);
printf("\n");
delet(p);
printf("after delete\n");
for(i=0;i<=last-1;i++)
printf("%d ",node[i]);
printf("\n");
break;
case 3:
printf("please enter the pot r and the value s\n");
scanf("%d %d",&r,&s);
printf("before modify\n");
for(i=0;i<=last-1;i++)
printf("%d ",node[i]);
printf("\n");
modify(r,s);
printf("after modify\n");
for(i=0;i<=last-1;i++)
printf("%d ",node[i]);
printf("\n");
break;
case 4:
printf("please enter the pot p and the value x\n");
scanf("%d %d",&u,&v);
printf("before insert\n");
for(i=0;i<=last-1;i++)
printf("%d ",node[i]);
printf("\n");
insert(u,v);
printf("after insert\n");
for(i=0;i<=last-1;i++)
printf("%d ",node[i]);
printf("\n");
break;
case 5:
flag=1;
break;
default:
printf("input error\n");
}
}while(!flag);
return(0);
}
void delet(int p) //在线性表中删除元素函数
{
int j;
if(p>last-1||p<0)
printf("wrong position!\n");
else
{
for(j=p+1;j<=last-1;j++)
node[j-1]=node[j];
last=last-1;
}
}
void insert(int p,int x) //在线性表中插入元素函数
{
int m;
if(last==max)
printf("the list is full!\n");
else
{
for(m=last-1;m>=p;m--)
node[m+1]=node[m];
node[p]=x;
last=last+1;
}
}
运行不了

答:c语言中的find函数提供了一种对数组、STL容器进行查找的方法。

函数功能----
查找一定范围内元素的个数。

查找[first,last)范围内,与toval等价的第一个元素,返回一个迭代器。如果没有这个元素,将返回last。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-10-19
find()应该是用于查找输入的数是否存在在node数组中,但你的程序中并没有写find()函数的具体实现代码,所以程序无法运行。本回答被网友采纳
第2个回答  2010-10-19
你哪里复制来的啊。
少一了一个find函数的内容。本回答被网友采纳
第3个回答  2010-10-19
1.io.h定义了不少的用于文件操作的函数,如write()可以写如文件信息。
2.
dir.h定义了struct ffblk,findfirst(),findnext()等结构体和库函数。用于windows下的目录文件操作。findfirst("e:\\tc\\",struct ffblk *ff,0),他会把tc下的一个文件信息输入结构体中,然后调用findnext()用于查找下个文件。
3.stdio.h就是标准输入输出头文件
4.stdlib.h 就是标准库头文件 std可以看作标准 stadndrd io是iostream输入输出流--in out. lib是库的意思。
它的作用就是一般的稍微特殊一点的操作需要。像调用system指令啊什么的。
5.string.h是字符串头文件,定义了大量的用于字符串处理的函数,如连接,拷贝等。

如果对您有帮助,请记得采纳为满意答案,谢谢!祝您生活愉快!

vaela
相似回答