C++ 벡터 find()

Jmnote (토론 | 기여)님의 2023년 9월 17일 (일) 14:45 판

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 }}