求大神 求填坑指点程序错误。。。

词索引表的程序
求大神指点错误在哪里_c++吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:150,448贴子:
词索引表的程序
求大神指点错误在哪里收藏
#include & stdio.h &#include & stdlib.h &#include & string.h &#define
MaxBookNum
//假设只对1000本书建立索引表#define
//索引表的最大容量#define
MaxLineLen
//书目串的最大长度#define
MaxWordNum
//词表的最大容量typedef
ElemT //定义链表数据元素类型为整型(书号类型)typedef struct{ char *}HStypedef struct LNode{ ElemT struct LNode *}LNode,*LinkLvoid InitList(LinkList *L) ;void PrintList(LinkList L) ;ElemType GetElem(LinkList L, int i, ElemType *e) ;int LocateElem(LinkList L,ElemType e) ;void DestroyList(LinkList L) ;void InitString(HString *T) ;void StrAssign( HString *T, char *cha) ;void StrCopy( HString *T , HString S ) ;void StrPrint(HString T, FILE *fp) ;void ClearString(HString *T) ;int StrCompare(HString S,HString T) ;//--------------------------------------------------------//typedef struct { char item[ 20 ][ 20 ] ; //字符串的数组
//词表的长度} WordListT
//词表类型(顺序表)typedef struct { HS
//关键词 LinkL
//存放书号索引的链表} IdxTermT
//索引项类型typedef struct { IdxTermType item[ MaxKeyNum + 1 ] ;} IdxListT
//索引表类型(有序表)//主要变量char buf[ 256 ] ;
//书目串缓冲区WordListT
//词表HString oftenwords[ 7 ] ;
//常用词表//---------------------Basic Operation---------------------//void InitIdxList( IdxListType *idxlist ) ;
//初始化,置索引表idxlist为空表,且在idxlist.item[0]设一空串void GetLine( FILE *fp ) ;
//从文件中读入一个书目信息到书目串缓冲区bufvoid ExtractKeyWord( ElemType *bno ) ;
//从书目串缓冲区提取书名关键词到词表wdlist,书号存入bnoint InsIdxList( IdxListType *idxlist , ElemType bno ) ; //将书号为bno的书名关键词按词典顺序插入索引表idxlistvoid PutText( FILE *fp , IdxListType idxlist ) ;
//将生成的索引表idxlist输入到文件中//---------------------For Insert--------------------------//void GetWord( int i , HString *wd ) ;
//用wd返回词表wdlist中第i个关键词int Locate( IdxListType idxlist , HString wd , int *b );//在索引表idxlist中插叙是否存在与wd相等关键词.若存在,则返回其在索引表中的位置,且b取TREUE;否则返回插入位置,且b取值FALSE.void InsertNewKey( IdxListType *idxlist , int i , HString wd ) ;//在索引表idxlist的第i项上插入新关键词wd,并初始化书号索引的链表为空表int InsertBook( IdxListType *idxlist , int i , int bno ) ; //在索引表idxlist的第i项中插入书号为bno的索引void OftenWords( ) ;int IsOftWords( char *temp ) ;int MakeNode( LinkList *p , ElemType bno ) ;void Appand( LinkList bnolist , LinkList p ) ;//---------------------For Query---------------------------//void ExtractyWord( int BookNum[ ] , char words[ ] ) ;void ExtractyName( char name[ ] , WordListType *namewords ) ;void FindtheSame( int BookNum[ ] , int Num[ ] ) ;void Query( FILE *fp , char *name ) ;
//从关键词索引表中查找是否包含某本书//-------------------------------------------------------//#include "bookinfo.txt"void InitIdxList( IdxListType *idxlist );{ (*idxlist).last = 1 ; InitString( &(*idxlist).item[ 0 ].key ) ; (*idxlist).item[ 0 ].bnolist = ( LinkList )malloc( sizeof( LNode ) ) ; (*idxlist).item[ 0 ].bnolist-&next = NULL ;}void GetLine( FILE *fp ){ buf[ 256 ] = ' ' ; fgets( buf , 256 , fp ) ;}void OftenWords( )
//构造常用词表{ for( i = 0 ; i & 7 ; ++ i ) {
InitString( (oftenwords+i) ) ; } StrAssign( &(oftenwords[ 0 ]) , "an" ) ; StrAssign( &(oftenwords[ 1 ]) , "a" ) ; StrAssign( &(oftenwords[ 2 ]) , "to" ) ; StrAssign( &(oftenwords[ 3 ]) , "of" ) ; StrAssign( &(oftenwords[ 4 ]) , "the" ) ; StrAssign( &(oftenwords[ 5 ]) , "The" ) ; StrAssign( &(oftenwords[ 6 ]) , "and" ) ; }int IsOftWords( char *temp )
//判断是否为常用词表{ for( i = 0 ; i & 7 ; ++ i ) {
if( !strcmp( oftenwords[ i ].ch , temp ) )
return OK ; } return ERROR ;}void ExtractKeyWord( ElemType *bno ){ char temp[ 20 ] ; int j , i = 0 ;
wdlist.last = 0 ; while( buf[ i ] != '\0' && buf[ i ] != '\n' && buf[ i ] != ' ' ) {
while( buf[ i ] != ' ' && buf[ i ] != '\0' && buf[ i ] != '\n' )
temp[ j ] = buf [ i ] ;
temp[ j ] = '\0' ;
if( 0 == wdlist.last
*bno = atoi( temp ) ;
wdlist.last ++ ;
if( !IsOftWords( temp ) )
strcpy( wdlist.item[ wdlist.last - 1 ] , temp ) ;
wdlist.last++ ;
++ } wdlist.last-- ;}int InsIdxList( IdxListType *idxlist , ElemType bno ){ int i , j , HS for( i = 0 ; i & wdlist. ++ i ) {
GetWord( i , &wd ) ;
j = Locate( *idxlist , wd , &b ) ;
InsertNewKey( idxlist , j , wd ) ;
//插入新的索引项
if( !InsertBook( idxlist , j , bno ) )
//插入书号索引
return OVERFLOW ; } return OK ;}void PutText( FILE *fp , IdxListType idxlist ){ LinkL for( i = 1 ; i & idxlist. ++ i )
//0号空置 {
StrPrint( idxlist.item[ i ].key , fp ) ;
p = idxlist.item[ i ].bnolist-&
while( p )
printf( "%d " , p-&data ) ;
fprintf( fp , "%d " , p-&data ) ;
printf( "\n" ) ;
fprintf( fp , "%c " , '\n' ) ; }}//------------------------For Insert------------------------------//void GetWord( int i , HString *wd ){ char *p = *( wdlist.item + i ) ;
//取词表中第i个字符串 StrAssign( wd , p ) ;
//生成关键字字符串}int Locate( IdxListType idxlist , HString wd , int *b ){ int i , for( i = idxlist.last - 1 ; ( m = StrCompare( idxlist.item[ i ].key , wd ) ) & 0 ; -- i ) ; if( m == 0 )
*b = TRUE ; } else {
*b = FALSE ;
return i + 1 ;
//返回插入的位置 }}void InsertNewKey( IdxListType *idxlist , int i , HString wd ){ for( j = (*idxlist).last - 1 ; j &= -- j )
//后移索引项
(*idxlist).item[ j + 1 ] = (*idxlist).item[ j ] ; //插入新的索引项 StrCopy( &(*idxlist).item[ i ].key , wd ) ;
//串赋值 InitList( &(*idxlist).item[ i ].bnolist ) ;
//初始化书号索引表为空表 ++ (*idxlist).}int MakeNode( LinkList *p , ElemType bno ){ *p = ( LinkList )malloc( sizeof( LNode ) ) ; if( !( *p ) )
return ERROR ; ( *p )-&data = return OK ;}void Appand( LinkList bnolist , LinkList p ) { p-&next = bnolist-& bnolist-&next =}int InsertBook( IdxListType *idxlist , int i , int bno ){ LinkL if( !MakeNode( &p , bno ) )
return ERROR ;
//分配失败 Appand( (*idxlist).item[ i ].bnolist , p ) ;
//插入新的书号索引 return OK ;}//--------------------------For Query-----------------------------------//void ExtractyWord( int BookNum[ ] , char words[ ] ) { int i = 0 , j = 0 , k = 0 ; char temp[ 5 ] ; while( buf[ i ] != ':' )
//key word {
words[ i ] = buf[ i ] ;
++ } words[ i ] = '\0' ;
while( buf[ i ] != '\n' ) {
while( buf[ i ] != ' ' && buf[ i ] != '\n' )
temp[ j ] = buf[ i ] ;
temp[ j ] = '\0' ;
BookNum[ k ] = atoi( temp ) ;
++ }}void ExtractyName( char name[ ] , WordListType *namewords ) { int i = 0 , j = 0 ; (*namewords).last = 0 ; while( name[ i ] != '\0' ) {
while( name[ i ] != ' ' && name[ i ] != '\0' )
(*namewords).item[ (*namewords).last ][ j ] = name[ i ] ;
(*namewords).item[ (*namewords).last ][ j ] = '\0' ;
++ (*namewords).
if( name[ i ] == '\0' )
++ }}void FindtheSame( int BookNum[ ] , int Num[ ] ){ int k , j = 0 ; for( k = 0 ; k & 10 ; ++ k )
//也可以设法把BookNum[]的长度传近来 {
if( BookNum[ k ] )
while( Num[ j ] && j & 10 )
if( BookNum[ k ] == Num[ j ] )
if( !Num[ j ] || j &= 10 )
BookNum[ k ] = 0 ;
} }}void Query( FILE *fp , char *name ) { char words[ 20 ] ; WordListT int i , times = 0 , j = 0 ; int BookNum[ 10 ] = { 0 }, Num[ 10 ] = { 0 }; ExtractyName( name , &namewords ) ; while( !feof( fp ) ) {
GetLine( fp ) ;
ExtractyWord( Num , words ) ;
for( i = 0 ; i & namewords. ++ i )
if( !strcmp( words , namewords.item[ i ] ) )
{ //存储书号
if( 0 == times )
//第一次,保留所有书号
while( Num[ j ] )
BookNum[ j ] = Num[ j ] ;
//后续次,保留相同的书号,不同的书号则置为0
FindtheSame( BookNum , Num ) ;
} // for } // while
//判断并锁定书号 j = 0 ; while( !BookNum[ j ] && j & 10 )
j ++ ; if( j &= 10 )
printf( "Can't find that book!" ) ; else
printf( "Oh, Find the book you want! The Number is :%d\n" , BookNum[ j ] ) ;}//----------------------------------------------------------------//int main( ){ FILE *fi , *fo , * IdxListT ElemT if( !( fi = fopen( "书目文件.txt" , "r" ) ) || !( fo = fopen( "关键词索引文件.txt" , "w") ) ) { //注意:“书目文件”的最后一条字符串后面要多打一个空格!
printf( "Cannot Open the file!\n" ) ;
exit( 0 ) ; } OftenWords( ) ; InitIdxList( &idxlist ) ; while( !feof( fi ) ) {
GetLine( fi ) ;
ExtractKeyWord( &bno ) ;
InsIdxList( &idxlist , bno ) ; } PutText( fo , idxlist ) ; fclose( fi ) ; fclose( fo ) ; if( !( fp = fopen( "关键词索引文件.txt" , "r") ) ) {
printf( "Cannot Open the file!\n" ) ;
exit( 0 ) ; } Query( fp , "Numerical Analysis" ) ; fclose( fp ) ; return 0 ;}
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或在VS2010中配置好opencv2.4.6后运行范例程序,出现171错误,求大神指导 配置图和程序如下,在线坐等_百度知道
提问者采纳
/zhidao/pic/item/7e3ecfc96a5429fadcd100baa12b06.jpg" esrc="http.baidu.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="<a href="/zhidao/wh%3D450%2C600/sign=782f04ef2d/7e3ecfc96a5429fadcd100baa12b06://c.baidu.hiphotos你配置的不对吧&nbsp://c://c.com/zhidao/wh%3D600%2C800/sign=45e888bd8026cffc697fb7b/7e3ecfc96a5429fadcd100baa12b06.hiphotos
2.4.6不用配置!只配置包含文件和库文件
提问者评价
多加了静态库而已哈!
其他类似问题
按默认排序
其他1条回答
x86&#92:(OpenCV安装目录)&#92;vc10&#92;opencv&#92;build&#92;重新开机再试试你有没有设置环境变量呢?在系统变量“PATH”中添加
已经解决了哈 !不用添加哈!
vs2010的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁UG8.5 32位安装遇到这个问题,求大神指点_ug吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:40,535贴子:
UG8.5 32位安装遇到这个问题,求大神指点收藏
这个要怎么解决
估计你之前装过8.0的吧
此图片是我电脑XP系统32位同时启动ug6.0、7.0不同国家语言界面图片。另外还安装了ug8.5,安装多个版本的ug可以从高版本到低版本进行安装,也可以从低版本到高版本安装,还可以不按顺序安装,根本就不需要卸载其他版本,别听网上某些傻逼瞎讲误人子弟
最笨的办法,你先把ug软件卸载干净-而后用360系统重装大师做系统-安装ug,在这里我以我的电脑XP系统32位安装ug6.0、7.0、8.5为例说下步骤,首先将3给版本许可证文件更改为自己的计算机名,只安装ug6.0主程序-复制粘贴那几个文件夹到主程序安装目录-找主程序目录下的UGS\NX 6.0\UGFLEXLM文件下的lmtools.exe双击打开添加相关选项并停止服务器-启动服务器即可打开ug6.0,同理ug7.0也可打开,只需把UGS\NX 7.0\UGFLEXLM文件下的lmtools.exe双击打开删除ug6.0的服务器添加相关选项并停止服务器-启动服务器即可,现在安装ug8.5,他妈个逼切的ug8.5太变态,参照网上唐康林安装过程岂可,不能只安装主程序否则打不开
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或求C++大神指导~~~~~~~这个程序到底错在哪里??我删了一个构造函数后它又提示我没有合适的构造函数....._百度知道
求C++大神指导~~~~~~~这个程序到底错在哪里??我删了一个构造函数后它又提示我没有合适的构造函数.....
;&#39::&& Person(Person &),;IdPerson&class Person{ char IdPerson[19];&#92; cout&身份证号;&10000&Person:&&cstring&gt,woman};&& Ps1;&#92;&HomeAddress[0]=&#39;&&&;&lt.input();&#39; Ps3;&&&lt.Print();&#39;南京市黄浦路1号& cout&析构Person& else Sex= if(ch==&#39;&#92;;日&&n&#39;家庭住址,19):~Person(){ cout&姓名;m&#39,&&&#92;} int main(){ Person
Ps1(&n&#39.getline(HomeA cin&&#92; strcpy(Name,name);& if(Sex==man)cout&&using namespace std:& Tsex S男&}void Pi&#47; cout&出生年月日;&#92;请输入地址.HomeAddress); ~Person(),T0&#39;0&#39;&&gt:&& Birthday=0;:&月&quot, Ps3:;&lt,id); cin&&&n&#39; int B&#92,格式日写作;朱海鹏&&lt:Person(){ IdPerson[0]=&#39;;&&#92;i&#47;Sex=endl,50);& Sex= strcpy(HomeA Birthday=Ps;endl, Ps2(Ps1);拷贝构造Person&& Ps2; void input(),char homeadd[50]),Ps;161&& strcpy(IdP&lt:&
char HomeAddress[50]: Person(char id[19],char name[20]:&&;&&&&& Sex=Ps;}P&&&&#92;&&){ cout&}P&#39; strcpy(N&0&#39;Name[0]=&#39;enum Tsex{unknow,
Ps3;&&构造Person&
char Name[20];;100&&lt.getline(N cout&&lt.Print(); else if(Sex==woman)cout&
cout&& i=i%10000.Name);&&请输入性别m或w; void Print();请输入生日.S&#include& cout&&#92;&#92,int birthday=0; strcpy(HomeA&#39;& i=B
else cout&HomeAddress&&quot:Person(Person & Ps){ cout&0&#39:Person(char id[19]=&#39;&&n&#39;&lt.getline(IdP&quot,&&#39;;&); strcpy(IdP&#39;}Person,Tsex sex=&&;&&lt:;; cin:,Ps;:; Person();i%100&&0&#39;&;&&年&quot:&quot,&未知&女&&0&#39;&lt,18位数字:&&B&;},homeadd);&#92,Ps;;&&&&n&#39;请输入姓名;}void P&&性别.Print():& cout&请输入身份证号;) Sex=Name&lt.IdPerson):Print(){ int i,char name[20]=&#39;&&quot,20); Birthday=& cout&lt:input(){&#92;; cin,char homeadd[50]=&#39;iostream&n&#39; return 0;&&quot,n&#39#include&lt.B cout&lt
提问者采纳
给每个参数都赋予了默认值,所以在Ps3生成时。解决办法是不要每个变量都有默认值,系统并不知道应该调用哪个构造函数,空构造函数和赋值的构造函数明显都能符合因为你的带参数构造函数里
但当我把这一段删除了Person::Person(){ IdPerson[0]=&#39;&#92;0&#39;;Name[0]=&#39;&#92;0&#39;;Sex= Birthday=0;HomeAddress[0]=&#39;&#92;0&#39;;}它又会提醒我 error C2512: &#39;Person&#39; : no appropriate default constructor available这是为什么?
如果你不要无参数的构造函数了,那Ps3无论如何也要有至少一个参数才行。所以最好还是挑一个参数不让它有默认值吧
提问者评价
原来是这样,感谢!
其他类似问题
按默认排序
其他1条回答
我将char id[19]=&#39,有分歧点;&#92,要么都没有,主要问题是你的构造函数,由于你构造函数要么都有默认值刚在vc2005中通过编译并正常运行,所以编译器在选择构造函数的时候出现语义方面的判断错误;0&#39
构造函数的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 求大神ps的后果全集 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信