收到错误:"ISO C++ forbids comparison between pointer and integer [-fpermissive]"如何解决?
Getting error: "ISO C++ forbids comparison between pointer and integer [-fpermissive]" How do I fix?
我正在制作一个将英语句子转换为猪拉丁语的程序。我不断在第 16 行收到错误"ISO C++禁止指针和整数 [-permissive] 之间的比较"。有什么帮助吗?
void wordfinder();
string word;
string engSent;
int x;
int main()
{
cout << "Enter a sentence: ";
getline(cin, engSent);
string word = "";
for (x = 0; x < engSent.length(); x++)
{
if (engSent[x] == " " || engSent[x] == "," || engSent[x] == ".")
{
wordfinder();
word = "";
}
}
return 0;
}
void wordfinder()
{
word = engSent.substr(0,engSent[x]);
cout << word;
}
检查以下字符而不是字符串:
if (engSent[x] == ' ' || engSent[x] == ',' || engSent[x] == '.')
相关文章:
- 函数何时会在c++中包含stack_Unwind_Resume调用
- Python中的for循环与C++有何不同
- TSP递归解的迭代形式
- 我应该在锁定TBitmap画布后解锁它吗
- 使用C++进行运行长度解压缩
- 为什么当我解模块化时,这个C++代代码"效率较低"?
- C++ 如何将数组值解压缩为函数参数
- struct.error:解压缩 C++ 结构时,解包需要 288 字节的缓冲区
- 在 Qt(C++) 中使用 QProcess 解压缩 - 提取目录问题
- 虚假唤醒是否会解锁所有等待线程,甚至是不相关的线程?
- 在C++中释放内存期间,迭代器与指针有何不同
- 没有取消引用/解包对象的标准方法?
- 浏览压缩文件与游览解压缩它们
- 标准对此指向成员函数类型模板参数有何说明?是我的代码有误,还是 MSVS 16.6 有问题?
- ISO C++禁止指针和整数 [-fpermissive] [c++] 之间的比较
- 如何在C++向量中解压缩多个值
- 模板函数签名在 C++/CLI 中解包
- 解压缩 C 样式数组以及C++中的参数包
- 如何在 cpp 中解压缩数字,如果它们是使用 struct.pack(fmt, v1, v2, ..) 打包在 pyth
- c++ 为什么我不应该从不同的线程解锁互斥锁