L’école a une boîte aux objets trouvés, et box en donne le contenu. Écris in_the_box(box, thing) : utilise find pour chercher thing, puis renvoie true s’il y est et false sinon. Les noms doivent être identiques, majuscules comprises.
in_the_box({"umbrella", "scarf", "glove"}, "scarf")→Truein_the_box({"umbrella", "scarf"}, "hat")→Falsebool in_the_box(const vector<string> &box, const string &thing)#include <algorithm>
#include <string>
#include <vector>
using namespace std;
bool in_the_box(const vector<string> &box, const string &thing) {
// ton code ici: cherche thing avec find
return false;
}
Exécuter teste les exemples. Quand ils sont bons, appuie sur Envoyer.