警告:声明无效 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按值获取它的参数并返回结果,因此不会修改输入值。
关于c++ - 警告 : statement has no effect (C++),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34837098/