c++ - when directly sum up every individual element in a string to int, what is the value represent? -
like when when s = "wendy", got 551. what's that?
for(size_t = 0; < s.length(); i++) { sum += s.at(i); }
it's sum of ascii values in string. each character corresponds numerical value between 32 , 127 (ignoring wide characters , unicode stuff since that's complicated).
if want more information, try looking "ascii".
Comments
Post a Comment