0

我正在通过阅读 C++ Essential 来学习 C++。我试图实施 Q 3.1,参考其答案如下。


using namespace std;  

*****typedef vector<string> vstring;*** //interruppted**
map<string, vstring> families;  

void populate_map(ifstream &nameFile, map<string,vstring>)& families);

 void display_map(const map<string,vstring> &families, ostream &os);

 void query_map(const string&family, const map<string,vstring> &families)

 int main()
 {
     map<string,vstring> families;
     ifstream nameFile("e3.3.txt")
     if(!nameFile){
         cerr<<"Unable to find e3.3.txt file. Bailing out!\n";            
                   return;
                   }
     populate_map(nameFile,families);

     string family_name;
     while(1){
              //!!loop user says to quit...
              cout<<"Please enter a family name or q to quit";
              cin>> family_name;
              if(family_name="q") break;
              query_map(family_name,families);
              }
              display_map(families);
     }


但程序在"typedef vector<string> vstring;" with error" expected init-declarator before '<' token "

请帮助我摆脱这种困惑。

4

0 回答 0