+ 8
std::string str = "test";
int sum = 0;
for (char i : str)
sum += int(i);
std::cout << sum;
+ 1
I dont know much about C++ but I guess this can be achieved by typecasting each character of a string into a char value and then into an int value.