小编Che*_*za2的帖子

C++如何将整数文字连接起来?

我试图将一个文字与一个整数连接起来.

问题是当使用+运算符将文字与整数连接时,它告诉我" error: invalid operands of types 'const char*' and 'const char [17]' to binary 'operator+'".

这是相关代码:

if ( ( A == 0 ) | ( B == 0 ) ) {

    cout << "Sorry, gcd(" + A + ',' + B + ") is undefined.\n";
    return 0;

}
Run Code Online (Sandbox Code Playgroud)

c++

1
推荐指数
1
解决办法
75
查看次数

标签 统计

c++ ×1