有下列程序,当输入4时,程序的输出结果是() #include &lti...
发布于 2022-03-03 16:11:48
有下列程序,当输入4时,程序的输出结果是()
#include <iostream> #include <algorithm> #include <vector> using namespace std typedef vector < int > A void dispVector(A v) { A::iterator t for (t=v.begin()t!=v.end()++t) { cout<<(*t)<<" " } cout<<endl } int main () { A iVector int i int value for (i=1 i<=10 i++) iVector.push_back(i) A::iterator pos cin>>value pos=find(iVector.begin(),iVector.end(),value) if (pos != iVector.end()) cout<<pos - iVector.begin()<< endl else cout << value << endl return 0 }
登录后免费查看答案
关注者
0
被浏览
14