Kodewick
Start learning →
Starter←→0 / 60

Party guests

#022Startervector2 min

One more guest is coming to the birthday party. Write add_guest(guests, name) to add name to the end of the list and return the new list. The list may be empty.

Examples
add_guest({"Amy", "Bao"}, "Coco")→['Amy', 'Bao', 'Coco']
add_guest({}, "Li")→['Li']
The functionvector<string> add_guest(vector<string> guests, const string &name)
main.cpp
#include <string>
#include <vector>
using namespace std;

vector<string> add_guest(vector<string> guests, const string &name) {
    // your code here: add name to the end of guests
    return guests;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.