不知道编写过程中出现了什么问题,运行不了

https://www.dooccn.com/cpp/#id/c555fe3e71b2f27941c2f60f227342ec

不知道你的程序要做什么,加上一个调用:

#include <iostream>
using namespace std;

string q2b(char a, int b, bool c)
{
    string ret = "The ";
    if (b % 3 > 0)
        ret += "quick ";
    else
        ret += "slow ";
    c = (!c || c) && (a >= 'A' && a <= 'Z');
    if (c)
        ret += "brown ";
    else
        ret += "blue ";
    switch (b)
    {
    case 4:
        ret += "fox";
        break;
    case 5:
        ret += "penguin";
    case 6:
        ret += "bear";
        break;
    default:
        ret += "cat";
    }
    return ret;
}
int main()
{
    cout <<  q2b(1,2,0);
        return 0;
}

The quick blue cat

Compilation Failed


/usr/bin/ld: /usr/lib/x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

编译失败,未定义main方法,main方法是程序的入口,没有入口则无法执行,因此需要在代码中韩定义一个main方法才行 比如

int main(){
// 自己的代码逻辑
return 0;
}