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