Kodewick
Comece a aprender →
Básico←→0 / 60

Achados e perdidos

#050Básicofind(…) != end()3 min

A escola tem uma caixa de achados e perdidos, e box lista o que tem nela. Escreva in_the_box(box, thing): use find para procurar thing e devolva true se estiver lá, false se não. Os nomes precisam bater exatamente, maiúsculas incluídas.

Exemplos
in_the_box({"umbrella", "scarf", "glove"}, "scarf")→True
in_the_box({"umbrella", "scarf"}, "hat")→False
A funçãobool 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) {
    // seu código aqui: procure thing com find
    return false;
}
Ctrl + Enter também executa
Resultado

Executar testa os exemplos. Quando parecerem certos, Enviar.