+ 1

Isogram challenge c++ - answered, thank you.

Could anyone give me a tip on how to solve the Isogram challenge in c++? I‘ve been trying different things for the last three hours and still couldn‘t manage to solve the problem. For instance, this little bit of code gives me the following warning: comparison of integer expressions of different signedness “int” and “std::...” although many examples I found online suggest exactly this approach.? Code bit: (before string declared) for (int i = 0; i < string.length(); i++) { for (int j = i+1; j < string.length(); j++) { if (string[i] == string[j]) {return false; } } } and so on... Thanks for any ideas!

29th Jun 2020, 10:45 AM
The_Fox
The_Fox - avatar
1 Antwort
+ 1
string.length returns an std::..... unsigned int or sth. like this. Try: for(unsigned int i=0;........) This would be better as string length is ever positive.... Moreover you can just ignore some warnings
29th Jun 2020, 1:54 PM
Alexander Thiem
Alexander Thiem - avatar