哪里出错了?
有下面一段程序:
//---------------------------------------------------------------------------
#include <vector>
#include <iostream>
#include <string>
#include <list>
//---------------------------------------------------------------------------
struct Entry{
string bookname ;
string card ;
};
void f(vector<Entry>& ve, list<Entry>& le)
{
sort(ve.begin(), ve.end()) ;
unique_copy(ve.begin(), ve.end), le.begin()) ;
}
void f1(vector<Entry>& ve, list<Entry>& le)
{
sort(ve.begin(), ve.end) ;
unique_copy(ve.begin(), ve.end(), back_insert(le))
}
int main(int argc, char* argv[])
{
vector<Entry> &vbook ;
list<Entry>& &lbook ;
f(vbook, lbook) ;
return 0;
}
//---------------------------------------------------------------------------
在vc6种编译时除下面错误:
aglor1.cpp
G:\exise\aglor1.cpp(13) : error C2146: syntax error : missing ';' before identifier 'bookname'
G:\exise\aglor1.cpp(13) : error C2501: 'string' : missing storage-class or type specifiers
G:\exise\aglor1.cpp(13) : error C2501: 'bookname' : missing storage-class or type specifiers
G:\exise\aglor1.cpp(14) : error C2146: syntax error : missing ';' before identifier 'card'
G:\exise\aglor1.cpp(14) : error C2501: 'string' : missing storage-class or type specifiers
G:\exise\aglor1.cpp(14) : error C2501: 'card' : missing storage-class or type specifiers
G:\exise\aglor1.cpp(16) : error C2065: 'vector' : undeclared identifier
G:\exise\aglor1.cpp(16) : error C2275: 'Entry' : illegal use of this type as an expression
G:\exise\aglor1.cpp(12) : see declaration of 'Entry'
G:\exise\aglor1.cpp(16) : error C2065: 've' : undeclared identifier
G:\exise\aglor1.cpp(16) : error C2065: 'list' : undeclared identifier
G:\exise\aglor1.cpp(16) : error C2275: 'Entry' : illegal use of this type as an expression
G:\exise\aglor1.cpp(12) : see declaration of 'Entry'
G:\exise\aglor1.cpp(16) : error C2065: 'le' : undeclared identifier
G:\exise\aglor1.cpp(17) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
G:\exise\aglor1.cpp(21) : error C2275: 'Entry' : illegal use of this type as an expression
G:\exise\aglor1.cpp(12) : see declaration of 'Entry'
G:\exise\aglor1.cpp(21) : error C2275: 'Entry' : illegal use of this type as an expression
G:\exise\aglor1.cpp(12) : see declaration of 'Entry'
G:\exise\aglor1.cpp(22) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
G:\exise\aglor1.cpp(28) : error C2275: 'Entry' : illegal use of this type as an expression
G:\exise\aglor1.cpp(12) : see declaration of 'Entry'
G:\exise\aglor1.cpp(28) : error C2065: 'vbook' : undeclared identifier
G:\exise\aglor1.cpp(29) : error C2275: 'Entry' : illegal use of this type as an expression
G:\exise\aglor1.cpp(12) : see declaration of 'Entry'
G:\exise\aglor1.cpp(29) : error C2065: 'lbook' : undeclared identifier
G:\exise\aglor1.cpp(29) : error C2102: '&' requires l-value
G:\exise\aglor1.cpp(30) : error C2065: 'f' : undeclared identifier
Error executing cl.exe.
aglor1.obj - 22 error(s), 0 warning(s)
//____________________________________
请问错再哪了?