D??ó??3ìDò?±??ìaò??ò?°·???
??ìa?-??£o Problem statement You must work out a super string class, String, that is derived from the C++ standard class string. This derived String class must add two new member functions 1; a pattern recognition function that returns the number of occurrences of a string pattern in a string. This function must use operator overloading of the / (division) operator. 2; a function get_token that returns tokens extracted from the string A token is a substring occurring between space characters in the string or between space characters and the end of the string. The string " aaa bbb cc " has the tokens "aaa", "bbb", and "cc" . When the function is called the first time, it must return "aaa", the next time "bbb", and then "cc". When it is called the 4th time it must return an empty string, and when it is called the 5th time it starts all over returning "aaa". Optionally, you may extend the solution so that tokens may be separated by any character out of a set of character given as a string argument. 2???ò???£o ?êìa?èê?£o ??±?D?′′?¨ò???1|?ü??′óμ?′?′|àíàà£?String£??a??àà±?D?′ó C++ ?D±ê×?μ? string àà?ééú£?±?D??ú???ééúàà?Dìí?óá???3é?±oˉêy£o 1?¢?£ê?ê?±eoˉêy£?·μ???3??′??D???¨′??£ê?μ?3???′?êy?£??oˉêy±?D?ê1ó? / £¨3y·¨£?????·??????£ 2?¢ó?oˉêy get_token ′ó′??D?üè??3????o?2¢·μ??????o??£ ??o???×?·?′?μ?ò???×ó′?£??ü??óú×?·?′?μ?????????£??ò????óú????oí′??2?????£è?£o×?·?′?“ aaa bbb cc ”?Dμ???o?óD“aaa”?¢“bbb”oí“cc”?£μ±μúò?′?μ÷ó???oˉêyê±£??ü±?D?·μ??“aaa”£???′??ùμ÷ó?ê±·μ??“bbb”£?μúèy′?μ÷ó?ê±·μ??“cc”£?òà′?ààí??£μ±μú??′?μ÷ó???oˉêyê±£??ü±?D?·μ??ò?????′?£?×?oóμ±μú??′?μ÷ó??üê±£?·μ???á1?ó?′ó “aaa” ?aê??£???éò???òaà??1?a???a??·?°?£?è???o??éò?ó??3×é×?·?ò?íaμ?è?o?×?·?·???£??a×é×?·??éò?×÷?aò???′?2?êy′?μY?£ ??·¨·???£¨D′3é′ú??£?£o
éù?÷:?a??ê?′?2úμ???·¨£?òa?????yêμ?????¨1|?ü£??é?ü???úDèòaDT??£??£í???MFCμ?3??§??óD?ù°??ú£? |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |