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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -