반응형
find
1.소스
#include <iostream> #include <cassert> #include <algorithm> #include <list> #include <iterator> using namespace std; int main() { int a[10] = {12, 3, 25, 7, 11, 213, 7, 123, 29, -31}; // Find the first element equal to 7 in the array: int* ptr = find(&a[0], &a[10], 7); assert (*ptr == 7 && *(ptr+1) == 11); cout << *ptr << "\n"; return 0; }
2.출력
g++ -o find1 find1.cpp hacker@HACKER:~/cpp$ ./find1 7
반응형