lvi*_*lvi -1 c++ string compiler-errors char
好的,所以输入是一个字符串.当我尝试编译以下代码时,我得到了
c.cpp:42:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Run Code Online (Sandbox Code Playgroud)
为什么?
if(input[i] != ' ')
{
char s = input[i];
if(s == "+")
{
...
}
}
Run Code Online (Sandbox Code Playgroud)
在此语句中使用单引号
if(s == "+")
Run Code Online (Sandbox Code Playgroud)
就在这里
if(s == '+')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
84 次 |
| 最近记录: |