关于vector的数据类型错误
程序代码:
#include <iostream> #include <vector> using namespace std; vector<int> v; bool vec(vector<int>::iterator beg,vector<int>::iterator end,int i) { for(vector<int>::size_type ix=0;beg!=end;beg++) { cout<<"tips"<<endl; if(*beg==i) { cout<<"got it"<<endl; return true; } } cout<<"not exist"<<endl; return false; } int main() { int a,p; while(cin>>a) { v.push_back(a); } vector<int>::iterator beg=v.begin(); vector<int>::iterator end=v.end(); cout<<"write a ..."<<endl; vec(beg,end,cin>>p); return 1; }调用vec函数时出错
error C2664: 'vec' : cannot convert parameter 3 from 'class std::basic_istream<char,struct std::char_traits<char> >' to 'int'
谁能解释下为什么不?