"C++ 벡터 find()"의 두 판 사이의 차이

잔글 (Jmnote님이 C++ 벡터 find() 문서를 C++ 벡터 find() 구현 문서로 이동했습니다)
태그: 되돌려진 기여
1번째 줄: 1번째 줄:
==개요==
==개요==
;C++ 벡터 find()
;C++ 벡터 find() 구현


<syntaxhighlight lang='cpp' run>
<syntaxhighlight lang='cpp' run>

2023년 9월 10일 (일) 13:10 판

1 개요

C++ 벡터 find() 구현
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    vector<int> v = {3, 1, 4, 8};
    cout << (find(v.begin(), v.end(), 4) != v.end()) << endl; // 1 (exists)
    cout << (find(v.begin(), v.end(), 7) != v.end()) << endl; // 0 (not exists)
}

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}