the problem is this warning at 15 and 18 warning: array subscript has type ‘char’ [-Wchar-subscripts]
deal with Sample Input: They are students. aeiou Sample Output: Thy r stdnts.
#include <cstdio>
#include <cstring>
const int MAXN = 10005;
char str1[MAXN], str2[MAXN];
bool HashTable[128] = {false};
//use HashTable to record the item need to minus
int main()
{
fgets(str1, sizeof(str1), stdin);
fgets(str2, sizeof(str2), stdin);
int len1 = strlen(str1);
int len2 = strlen(str2);
for (int i = 0; i < len2; i++) {
HashTable[str2[i]] = true;
}
for (int i = 0; i < len1; i++) {
if (HashTable[str1[i]] == false) {
printf("%c", str1[i]);
}
}
return 0;
}
I can run it, but the warning I have no idea.
here