欢迎来到天天文库
浏览记录
ID:47104527
大小:68.50 KB
页数:13页
时间:2019-08-03
《C__大学教程课后习题答案17》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、SavitchInstructor’sResourceGuideProblemSolvingw/C++,7eChapter18Chapter18StandardTemplateLibrary1.SolutionstoandRemarksonSelectedProgrammingProjects1-5.Nosolutionsprovided.6.//****************************************************************////Ch18Proj6.cpp////Thisprogramrepresentsadocume
2、ntandqueryasasetofkeywords.//Itusesthebinarycosinemetrictothencomputethesimilarity//betweenthequeryanddocumentandoutputsthesimilarityasa//valuebetween0and1.////ThisprogramusesthegenericSTLsetclasses.//****************************************************************#include#incl
3、ude#include#include#include#include#include#include#includeusingnamespacestd;//FunctionprototypesvoidreadFileKeywords(set&setDocument,constcharfilename[]);voidinputKeywords(set&setKeywords);//************
4、************//InputKeywords://Inputsstringsfromthekeyboard//andstoresthemintothesetuntil//enterispressed.//************************voidinputKeywords(set&setKeywords){strings;cout<<"Enterkeywords,oneperline.Enterablanklinewhenfinished."13Copyright©2008PearsonEducation,Inc.Publishi
5、ngasPearsonAddison-WesleySavitchInstructor’sResourceGuideProblemSolvingw/C++,7eChapter18<6、***********************voidreadFileKeywords(set&setDocument,constcharfilename[]){ifstreamin_stream;strings;//Openthefilein_stream.open(filename);if(in_stream.fail()){cout<<"Inputfileopeningfailed."<7、){//Inputword,ideallyweshouldfilterout//punctuationandothernon-lettersbutwillskipnow//forpurposesofthisassignmentin_stream>>s;setDocument.insert(s);}in_stream.close();}//======================//mainfunction//======================intmain(){//Variabledeclarationsset
6、***********************voidreadFileKeywords(set&setDocument,constcharfilename[]){ifstreamin_stream;strings;//Openthefilein_stream.open(filename);if(in_stream.fail()){cout<<"Inputfileopeningfailed."<7、){//Inputword,ideallyweshouldfilterout//punctuationandothernon-lettersbutwillskipnow//forpurposesofthisassignmentin_stream>>s;setDocument.insert(s);}in_stream.close();}//======================//mainfunction//======================intmain(){//Variabledeclarationsset
7、){//Inputword,ideallyweshouldfilterout//punctuationandothernon-lettersbutwillskipnow//forpurposesofthisassignmentin_stream>>s;setDocument.insert(s);}in_stream.close();}//======================//mainfunction//======================intmain(){//Variabledeclarationsset
此文档下载收益归作者所有