急!!!高分求教C++高手!!!
中医程序猿 2002-10-21 09:45:59 按照书上打的程序为什么不能通过编译?
//文本查询系统,摘自[Lippman & 潘爱民02]P259
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <fstream.h>
#include <stddef.h>
#include <ctype.h>
typedef pair<short,short> location;
typedef vector<location, allocator> loc;
typedef vector<string, allocator> text;
typedef pair<text*, loc*> text_loc;
class TextQuery{
public:
TextQuery() { memset(this, 0, sizeof(TextQuery)); }
static void filter_elements(string felems) { filt_elems = felems; }
void query_text();
void display_map_text();
void display_text_locations();
void doit(){
retrieve_text();
separate_words();
filter_text();
suffix_text();
strip_caps();
build_word_map();
}
private:
void retrieve_text();
void separate_words();
void filter_text();
void strip_caps();
void suffix_text();
void suffix_s(string&);
void build_word_map();
private:
vector<string, alloctar> *lines_of_text;
text_loc *text_locations;
map<string, loc*, less<string>, allocatar> *word_map;
static string filt_elems;
};
string TextQuery::filt_elems("\",.;!?)(\\/");
int main()
{
TextQuery tq;
tq.doit();
tq.query_text();
tq.display_map_text();
}
void TextQuery::retrieve_text()
{//由于字数限制,函数实现部分省略
//源程序请见潘爱民译《C++ Primer中文版》第259页
...
}
void TextQuery::separate_words()
{...}
void TextQuery::filter_text()
{...}
void TextQuery::suffix_text()
{ ... }
void TextQuery::suffix_s(string &word)
{...}
void TextQuery::strip_caps()
{...}
void TextQuery::build_word_map()
{...}
void TextQuery::query_text()
{...}
void TextQuery::display_map_text()
{...}
我的系统Win2000 Advance Server + VC6