Kodewick
学びはじめる →
基礎←→0 / 60

落とし物箱

#050基礎find(…) != end()約 3 分

学校には落とし物箱があり、box には中にあるものが並んでいます。in_the_box(box, thing) を書きましょう。find で thing を探し、あれば true、なければ false を返します。名前は大文字も含めて完全に一致する必要があります。

例
in_the_box({"umbrella", "scarf", "glove"}, "scarf")→True
in_the_box({"umbrella", "scarf"}, "hat")→False
関数bool in_the_box(const vector<string> &box, const string &thing)
main.cpp
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

bool in_the_box(const vector<string> &box, const string &thing) {
    // ここにコードを書く:find で thing を探す
    return false;
}
Ctrl + Enter でも実行できます
結果

実行すると例で試せます。よさそうなら提出しましょう。