哪里出错了?

WiseNeuro WiseNeuro 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
有下面一段程序:
//---------------------------------------------------------------------------


#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)
//____________________________________
请问错再哪了?
...全文
评论 12
收藏 已收藏
分享
返回顶部
WiseNeuro
C++ 语言 65,214 成员 250,514 内容