0
警告:声明没有效果 行15 我必须显示在s2中找到的来自s1的所有字符。警告:声明没有效果(C++)
#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;
}
'tolower'返回参数的小写,不会改变参数本身。 –
'tolower(s2 [i]);'确实没有效果。你可能想's2 [i] = tolower(s2 [i]);' –
哦..谢谢:) – Krinsken