Everyone at the picnic needs a chair. Write enough_chairs(guests, chairs): guests is who's coming; return true if there are enough chairs and false if not. Nobody coming counts as enough.
enough_chairs({"Amy", "Bao", "Coco"}, 4)→Trueenough_chairs({"Amy", "Bao", "Coco"}, 2)→Falsebool enough_chairs(const vector<string> &guests, int chairs)#include <string>
#include <vector>
using namespace std;
bool enough_chairs(const vector<string> &guests, int chairs) {
int people = 0;
// your code here: set people to how many are on the list
return people <= chairs;
}
Run tries the examples. When they look right, Submit.