我正在通过阅读c ++来学习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 "
中断
请帮助我摆脱这种混乱。