Ad
  • Custom User Avatar

    C++:

    If I use 'case' then I see this error:

    main.cpp:17:50: error: function definition is not allowed here
    std::string how_much_i_love_youPK(int nb_petals) {

    main.cpp:23:50: error: function definition is not allowed here
    void testequal(std::string ans, std::string sol) {

    main.cpp:28:1: error: function definition is not allowed here
    {

    main.cpp:47:21: error: use of undeclared identifier 'how_much_i_love_youPK'; did you mean 'how_much_i_love_you'?
    dotest(r, how_much_i_love_youPK(r) );
    ^~~~~~~~~~~~~~~~~~~~~
    how_much_i_love_you

    main.cpp:6:13: note: 'how_much_i_love_you' declared here
    std::string how_much_i_love_you(int nb_petals) {

    main.cpp:47:11: error: use of undeclared identifier 'dotest'
    dotest(r, how_much_i_love_youPK(r) );

    main.cpp:53:40: error: function definition is not allowed here
    int main(int argc, const char *argv[]) {

    main.cpp:59:2: error: expected '}'
    }

    main.cpp:6:48: note: to match this '{'
    std::string how_much_i_love_you(int nb_petals) {

    7 errors generated.