Kodewick
Start learning →
Starter←→0 / 60

Cake message

#017StarterStrings2 min

The bakery can fit at most 12 characters on a cake (spaces count too). Write fits_on_cake(msg): true if it fits, false if not. An empty message fits.

Examples
fits_on_cake("Happy Birthday")→False
fits_on_cake("Hi Mom")→True
The functionbool fits_on_cake(const string &msg)
main.cpp
#include <string>
using namespace std;

bool fits_on_cake(const string &msg) {
    int length = 0;
    // your code here: set length to how many characters msg has
    return length <= 12;
}
Ctrl + Enter runs too
Result

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