标题:解释一下 这个代码 越详细越好
只看楼主
herong881111
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-10-17
结帖率:100%
 问题点数:0 回复次数:0 
解释一下 这个代码 越详细越好
#include <iostream.h>
#include <string.h>
#define N6
char * binary (char*s)
{static char * pstr[N]={"const","double","enum","float","signed","unsigned"};
 int low,high,mid
 low=o
 high=N-1
 while(low<=high)
 {mid=(low+high)/2
 if (strcmp(s,pstr[mid])<0)}
 high=mid-1
 else if (strcmp(s,pstr[mid])>0)
 low=mid+1,
 else return(pstr[mid]);
 }
 return(0);
 }
void main()
{char*a,*find;
   cout<<"输入要查找的字符串:";
   cin.getline(find,80);
a=binary(find);
if(a!=o) cout<<"找到字符串"<<a<<endl;
else cout<<"没找到!"<<endl
}
搜索更多相关主题的帖子: 代码 解释 
2010-10-20 15:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-323438-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.210911 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved