You are viewing a single comment's thread. Return to all comments →
It's better use the stl library
#include <iterator> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int key, sz; cin >> key >> sz; vector<int> a(sz); copy_n(istream_iterator<int>(cin), sz, begin(a)); cout << distance(begin(a), find(begin(a), end(a), key)); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Intro to Tutorial Challenges
You are viewing a single comment's thread. Return to all comments →
It's better use the stl library