警告:语句无效 (C++)
warning: statement has no effect (C++)
>警告:语句无效15号线我还必须显示 s1 中的所有字符,这些字符也可以在 s2 中找到。
#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;
int main()
{
char s1[250], s2[250];
unsigned int i;
cin.get(s1,250);
cin.get();
cin.get(s2,250);
for(i=0;i<strlen(s2);i++)
tolower(s2[i]);
for(i=0;i<strlen(s1);i++)
if(strchr(s2,tolower(s1[i])))
cout<<s1[i];
return 0;
}
std::tolower 按值获取参数并返回结果,因此不会修改输入值。
相关文章:
- Openssl 1.1.1d无效使用不完整的类型"struct dsa_st"
- 无法访问嵌套类.类的使用无效
- 如果用户输入无效,如何使用字符串变量-C++重复输入命令
- 如何解决错误:SCIP C++中的 SCIP 阶段无效 <10>
- 在没有参数列表的情况下使用模板名称"Event"无效,模板问题
- FFMPEG配置文件级别id大小无效
- 错误:从"int"到枚举c++的转换无效
- 如何修复此错误:className::className的无效使用
- 为什么将值返回函数传递给重载=运算符对运算符函数有效,而对其他运算符无效
- C++-模板嵌套类的引用初始化无效
- 错误:无效的预处理指令 #i 的意思是 #if?
- 多维数组 C++ 中数组下标的类型"int[int]"无效
- 在 C++ 中使用正则表达式错误时出现问题 括号表达式中的范围无效
- 从 'int' 到 'int*' CPP 的转换无效
- 如何接受 [ENTER] 键作为无效输入并发送错误消息
- 由于无效的 ValidateRgn() 子窗口不会收到WM_PAINT消息
- C++ PTHREADS - 无效转换无效*(*)()到无效*(*)(无效*)
- 声明为无效的变量或字段'...' Ardunio 编译器上的错误
- 数组下标的类型"float*[float]"无效
- 修改 std::vector 会使迭代器无效吗?