1038 - #include<iostream> #include<map>...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<map> #include<algorithm> #include<cstring> #include<cstdlib> using namespace std; struct Node { char id[108]; int freq; }; Node word[1008]; int seq[1008]; int num; int alpha2digit[26]; map<string, string> table; map<string, int> save; struct MyComp{ char *x,*y; x = word[seq[a]].id; y = word[seq[b]].id; return strcmp(x,y) < 0; } }; void init(){ alpha2digit['a' -'a'] = 2; alpha2digit['b'-'a'] = 2; alpha2digit['c'-'a'] = 2; alpha2digit['d' -'a'] = 3; alpha2digit['e'-'a'] = 3; alpha2digit['f'-'a'] = 3; alpha2digit['g' -'a'] = 4; alpha2digit['h'-'a'] = 4; alpha2digit['i'-'a'] = 4; alpha2digit['j' -'a'] = 5; alpha2digit['k'-'a'] = 5; alpha2digit['l'-'a'] = 5; alpha2digit['m' -'a'] = 6; alpha2digit['n'-'a'] = 6; alpha2digit['o'-'a'] = 6; alpha2digit['p' -'a'] = 7; alpha2digit['q'-'a'] = 7; alpha2digit['r'-'a'] = 7; alpha2digit['s' -'a']=7; alpha2digit['t' -'a'] = 8; alpha2digit['u'-'a'] = 8; alpha2digit['v'-'a'] = 8;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2010 for the course CS 100 taught by Professor Acm during the Spring '10 term at Zhejiang University.

Page1 / 3

1038 - #include&lt;iostream&gt; #include&lt;map&gt;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online